[英]Does Stripe Checkout.js token callback block until payment processed?
I'm using Checkout.js to allow a delinquent customer to update their card details.我正在使用 Checkout.js 来允许拖欠客户更新他们的卡详细信息。
When they do this, I know that the outstanding invoice payment is retried.当他们这样做时,我知道未付款的发票付款被重试。
Does this happen as part of the checkout process?这是否作为结帐过程的一部分发生? ie does the token callback block until the payment has been retried and either succeeded or failed?
即令牌回调会阻塞,直到付款被重试并且成功或失败?
Or does this happen asynchronously?或者这是异步发生的?
It is not blocking.它不是阻塞。 But it is using Promises.
但它正在使用承诺。 I mean, when the promise returned (
then
), You can check the returned code.我的意思是,当承诺返回(
then
)时,您可以检查返回的代码。 If it's a success, it's mean you the credit card is valid, and you can use the token.如果成功,则表示您的信用卡有效,并且可以使用令牌。
If you got token, you send the token to your server, and try to capture the money.如果您获得令牌,则将令牌发送到您的服务器,并尝试获取资金。 This you can so also using non-blocking promises.
这也可以使用非阻塞承诺。
Checkout only collects a customer's payment information and tokenizes it. Checkout仅收集客户的付款信息并将其标记化。 Once the token is created, you then send it to your backend server so that you can use it in an API request.
创建令牌后,您将其发送到后端服务器,以便您可以在 API 请求中使用它。
In your case, you want to update the customer's card, so you'd pass the token ID as the source
parameter in a customer update request .在您的情况下,您想要更新客户的卡,因此您将令牌 ID 作为客户更新请求中的
source
参数传递。
Checkout's token
callback is called when the token is created.创建令牌时会调用 Checkout 的
token
回调。 In most cases, its only job is to send the token ID to the backend, usually by submitting a form or via an AJAX request.在大多数情况下,它唯一的工作是将令牌 ID 发送到后端,通常是通过提交表单或通过 AJAX 请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.