当用户下订单时,我们会在 iOS/Android 应用中创建 PaymentIntents(如果重要的话,使用 capture_method=manual
)。
一旦 charge.succeeded
webhook 触发,我们就会将订单发送到连接的地点。如果几分钟内没有发生这种情况,我们的订单就过期了。
有趣的是,十分之二的时间我们无法触发此 Webhook。
我想知道听这个网络钩子(Hook)是否真的明智,以便决定我们是否将订单发送到连接的帐户的地点,或者是否有更好的方法来确定一旦我们 try catch ,付款实际上会起作用它。
最佳答案
Webhook 是获取付款意图状态的推荐方法,但您也可以使用 API 来获取其状态。
引自 Stripe docs :
It is technically possible to use polling instead of webhooks to monitor for changes caused by asynchronous operations—repeatedly retrieving a PaymentIntent so that you can check its status—but this is markedly less reliable and may pose challenges if used at scale. Stripe enforces rate limiting on API requests, so exercise caution should you decide to use polling.
就您的情况而言,我建议等待 webhook,然后在几分钟后调用 PaymentIntents API或Charges API如果您还没有收到网络钩子(Hook)。
关于stripe-payments - Stripe Payment Intents 和 charge.succeeded webhook 有时不触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61285110/