Paolo Broccardo
Paolo Broccardo

Reputation: 1744

Receive and log webhook post

I have an account set up with Stripe.com. I have configured a webhook for testing and am sending test posts to a cfm page that "receives" these requests. However, I am not sure that this page is doing what it should be. Currently, I just dump out all data. Below is what the page code looks like.

When I run the page locally, or call it directly on our live test site, I get an email with all the data as expected. However, if I set the page up as a webhook url and then get Stripe to send a test message to it, nothing happens - no emails. I see nothing in the error logs either. What could be going wrong here? Could someone perhaps recommend a better way to receive and log the webhook calls from Stripe? I am a little clueless here. Thanks

<cfsavecontent variable="local.emailBody">
    <cfdump var="#GetHttpRequestData()#">
    <cfdump var="#HTTP#">
    <cfdump var="#REQUEST#">
    <cfdump var="#FORM#">
    <cfdump var="#VARIABLES#">
</cfsavecontent>

<!--- Build Email --->
<cfset sMessage.messageType = "email" />
<!--- Setup other Email settings like to,from etc --->


<!--- Send Email --->
<cfset application.Communication.SendMessage(sMessage)  />

Upvotes: 1

Views: 1503

Answers (1)

user1909962
user1909962

Reputation: 46

I'm sure by now you already figured this out, but you use...

ToString(getHTTPRequestData().content)

... or to put it in a CF object...

deserializeJSON(ToString(getHTTPRequestData().content))

Upvotes: 3

Related Questions