接收并记录 webhook 帖子 [英] Receive and log webhook post

查看:26
本文介绍了接收并记录 webhook 帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Stripe.com 上设置了一个帐户.我已经配置了一个用于测试的 webhook,并将测试帖子发送到接收"这些请求的 cfm 页面.但是,我不确定这个页面是否在做它应该做的事情.目前,我只是转储所有数据.下面是页面代码的样子.

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.

当我在本地运行页面或直接在我们的实时测试站点上调用它时,我会收到一封电子邮件,其中包含预期的所有数据.但是,如果我将页面设置为 webhook url,然后让 Stripe 向其发送测试消息,则什么都不会发生 - 没有电子邮件.我在错误日志中也看不到任何东西.这里可能出了什么问题?有人可以推荐一种更好的方法来接收和记录来自 Stripe 的 webhook 调用吗?我在这里有点不知所措.谢谢

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

推荐答案

我相信你现在已经想通了,但是你使用...

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

ToString(getHTTPRequestData().content)

...或者把它放在一个 CF 对象中...

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

deserializeJSON(ToString(getHTTPRequestData().content))

这篇关于接收并记录 webhook 帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆