【问题标题】:React-JS StripeCheckout get the Customer ID/Charge ID after successful purchaseReact-JS StripeCheckout 购买成功后获取Customer ID/Charge ID
【发布时间】:2021-10-08 21:34:17
【问题描述】:

我正在尝试在购买后获取客户 ID/费用 ID,并将客户 ID/费用 ID 发送到数据库中以供将来使用。

 import StripeCheckout from 'react-stripe-checkout';
     onToken = async (token) => {}
      <StripeCheckout
       stripeKey='pk_test_51JG'
        token={this.onToken}
        amount={this.state.grandTotal * 100}
        name='Payment'/>

【问题讨论】:

  • 问题是什么,你在哪里挣扎?

标签: node.js reactjs express stripe-payments


【解决方案1】:

推荐的方式是设置一个 webhook 端点并订阅 checkout.session.completed 事件:https://stripe.com/docs/payments/checkout/fulfill-orders#handle-the-event

根据您所说的“交易 ID”的确切含义,您需要的信息可能已经包含在其中,或者可以使用可用的 ID 从 Stripe 中检索到。

【讨论】:

  • 我需要条带费用 ID 或客户 ID,onToken = async (token)=>{} 仅在令牌响应中,我得到卡 ID。如何获取 Charge id 或 Customer ID?
猜你喜欢
  • 2016-10-06
  • 1970-01-01
  • 1970-01-01
  • 2022-01-19
  • 1970-01-01
  • 2015-10-13
  • 2019-03-11
  • 2020-01-12
  • 2022-01-09
相关资源
最近更新 更多