Stripe ConfirmCardPayment(前端)与 paymentintent.Confirm(后端)
Stripe ConfirmCardPayment (frontend) vs paymentintent.Confirm (backend)
什么时候前端选择confirmCardPayment
,什么时候后端选择paymentIntent.Confirm
?
目前我们的应用程序允许您以客人身份结账,如果您不是客人则保存信用卡或使用已保存的卡。
所有这些流程都在前端没有 confirmcardpayment
且后端没有 paymentintent.confirm
的情况下工作
我猜会有一段时间卡支付需要额外的身份验证,那就是我们需要在前端确认或在后端确认? (另外,when/why 一张卡需要额外的身份验证吗?这是新手 space 并且希望学习)
PS:上面 link 的 TLDR 是:
前端:
- 使用给定的卡或已保存的卡创建付款方式。
- 发送 POST /pay API 到后端
后端:
接收 API(验证用户是否经过授权 - 在我们的例子中)
创建一个支付意向,使用前端的 paymentmethodID 和从后端获取的 customerID(我们事先创建的 Stripe 的客户 ID)发送给 stripe
条纹 returns 我们的付款方式有状态。
双方都没有确认。
如果相同的付款方式试图用于其他客户,则失败。
如果相同的付款方式用于相同的客户(保存卡行为),它会起作用。
I'm guessing there will be a time where a card payment requires extra authentication and that is when we need to either confirm in the front end or conifrm in the backend?
您需要在前端执行此操作,因为客户身份验证是。在前端确认尝试付款,Stripe JS 库还将显示任何其他所需的 UI,例如客户银行的 3D 安全身份验证页面。
这对于接受其他类型的付款方式也很重要(您应该这样做,因为在结帐流程中使用更多本地付款方式会增加客户转化率)。例如,使用 iDEAL 的付款需要重定向到客户银行,这又是在客户端处理的。 https://stripe.com/docs/payments/ideal#payment-flow
(Also, when/why would a card require extra authentication? New to this space and looking to learn)
欧洲和英国的几乎任何交易现在都需要 3D 安全身份验证,而且它在全球范围内变得越来越普遍
https://stripe.com/docs/strong-customer-authentication
https://stripe.com/docs/payments/3d-secure
https://support.stripe.com/questions/strong-customer-authentication-sca-enforcement-date
Our code pretty much follows this
您链接的 Github link/flow 是使用 Stripe 的另一种方式,您尝试在后端付款,然后如果需要身份验证则需要执行 round-trip,但是通常首选使用 client-side 确认,因为它在接受其他付款方式时更具可扩展性。见注释
https://stripe.com/docs/payments/accept-a-payment-synchronously
什么时候前端选择confirmCardPayment
,什么时候后端选择paymentIntent.Confirm
?
目前我们的应用程序允许您以客人身份结账,如果您不是客人则保存信用卡或使用已保存的卡。
所有这些流程都在前端没有 confirmcardpayment
且后端没有 paymentintent.confirm
的情况下工作
我猜会有一段时间卡支付需要额外的身份验证,那就是我们需要在前端确认或在后端确认? (另外,when/why 一张卡需要额外的身份验证吗?这是新手 space 并且希望学习)
PS:上面 link 的 TLDR 是:
前端:
- 使用给定的卡或已保存的卡创建付款方式。
- 发送 POST /pay API 到后端
后端:
接收 API(验证用户是否经过授权 - 在我们的例子中)
创建一个支付意向,使用前端的 paymentmethodID 和从后端获取的 customerID(我们事先创建的 Stripe 的客户 ID)发送给 stripe 条纹 returns 我们的付款方式有状态。
双方都没有确认。
如果相同的付款方式试图用于其他客户,则失败。 如果相同的付款方式用于相同的客户(保存卡行为),它会起作用。
I'm guessing there will be a time where a card payment requires extra authentication and that is when we need to either confirm in the front end or conifrm in the backend?
您需要在前端执行此操作,因为客户身份验证是。在前端确认尝试付款,Stripe JS 库还将显示任何其他所需的 UI,例如客户银行的 3D 安全身份验证页面。
这对于接受其他类型的付款方式也很重要(您应该这样做,因为在结帐流程中使用更多本地付款方式会增加客户转化率)。例如,使用 iDEAL 的付款需要重定向到客户银行,这又是在客户端处理的。 https://stripe.com/docs/payments/ideal#payment-flow
(Also, when/why would a card require extra authentication? New to this space and looking to learn)
欧洲和英国的几乎任何交易现在都需要 3D 安全身份验证,而且它在全球范围内变得越来越普遍
https://stripe.com/docs/strong-customer-authentication
https://stripe.com/docs/payments/3d-secure
https://support.stripe.com/questions/strong-customer-authentication-sca-enforcement-date
Our code pretty much follows this
您链接的 Github link/flow 是使用 Stripe 的另一种方式,您尝试在后端付款,然后如果需要身份验证则需要执行 round-trip,但是通常首选使用 client-side 确认,因为它在接受其他付款方式时更具可扩展性。见注释
https://stripe.com/docs/payments/accept-a-payment-synchronously