Stripe Success_URL 查询字符串

huangapple go评论95阅读模式
英文:

Stripe Success_URL Querystring

问题

我已经实现了一个结账功能,定义了success_url。我已经将{CHECKOUT_SESSION_ID}添加到查询字符串中,它可以正常工作。我想包括其他信息,以便我可以将该响应与在我的数据库中进行付款的用户关联起来,例如客户电子邮件。session_id是唯一可以包括的变量吗,还是有一个变量列表?

这个URL有效:

'success_url' => 'https://www.psychology.com/personality/lizard/success.php?session_id={CHECKOUT_SESSION_ID}',

我尝试过{email}、{customer}.{email}、{customer->email}。

英文:

I have implemented a checkout that defines the success_url. I have added {CHECKOUT_SESSION_ID} to the querystring and it works fine. I would like to include other information that would allow me to tie that response to the user in my database that made the payment. For example, customer email. Is session_id the only variable that can be included or is there a list somewhere?

This URL works:

'success_url' =>  'https://www.psychology.com/personality/lizard/success.php?session_id={CHECKOUT_SESSION_ID}',
    I tried {email}
    {customer}.{email}
    {customer->email}`

答案1

得分: 0

唯一的模板变量是 CHECKOUT_SESSION_ID,出现在 success_url 上,我不认为你可以添加 CUSTOMER_EMAIL。这个 文档 展示了如何自定义成功页面以在页面上显示客户的电子邮件地址。然而,我认为这可能不是你要找的东西。如果你想要获取客户的电子邮件地址以保存到你的数据库,那么我建议你监听 webhooks 或检索客户 对象。Stripe webhooks 发送事件,你可以监听 checkout.session.completed,然后查看 customer_details.email

英文:

The only template variable is CHECKOUT_SESSION_ID on the success_url and I do not believe you can add CUSTOMER_EMAIL. This document shows how you can customize your success page to show the customer's email address on the page. However, I do think think that is what you're looking for. If you're trying to attain the customer's email to save to your database, then, I recommend that you listen to webhooks or retrieve the customer object. Stripe webhooks send events that you can listen to and with Checkout, you can listen to checkout.session.completed for instance and look at the customer_details.email

huangapple
  • 本文由 发表于 2023年8月11日 04:38:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76879174.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定