Receive and log webhook post

别来无恙 提交于 2019-12-31 04:06:39

问题


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)  />

回答1:


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))


来源:https://stackoverflow.com/questions/12758351/receive-and-log-webhook-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!