问题描述
我正在使用 Stripe 设置定期付款.我正在使用 react-stripe-elements 收集卡片信息,看起来有两种方法可以保存卡片以备后用:
I'm working on setting up recurring payments with stripe. I'm using react-stripe-elements to collect card information and it looks like there's two ways to save a card for later:
this.props.stripe.createToken()
this.props.stripe.createSource()
然后在后端创建一个客户:
Then create a customer on the backend:
stripe.customers.create({ source: tokenId })
stripe.customers.create({ source: sourceId })
条纹仪表板中的结果:
tokenId
tokenId
- tokenId 卡
sourceId
- sourceId 来源
- 源身份证
我的问题是这两种模式有什么区别?我应该使用一种而不是另一种吗?我注意到在 tokenId 模式中,卡片说 cvc/zip 检查已通过,而卡片在 sourceId 模式中没有说.但是 sourceId 模式还明确表示该卡是可收费和可重复使用的,这是否意味着使用 tokenId 模式保存的卡不可重复使用?sourceId 卡中的日志/事件是否更有用?两种模式的返回对象结构也不同.
My question is what is the difference between these two patterns? Should I be using one instead of the other? I notice in the tokenId pattern the card says cvc/zip check passed, while the card doesn't say that in the sourceId pattern. But the sourceId pattern also explicitly says the card is chargeable and reusable, does that imply that the card saved from using the tokenId pattern is not reusable? Are the logs/events in the sourceId card more useful? The return object structure for the two patterns is also different.
任何帮助将不胜感激,提前致谢!
Any help would be much appreciated, thanks in advance!
推荐答案
Token 只是用户卡片详细信息标记化后的字符串值结果.您可以使用令牌或来源一次性或订阅付款(前提是您在将其附加给客户之前不立即使用它来收费).
Token is just a string value result after tokenization of the user card details. You can use token or source for either one time or subscription payment(provided you don't use it to charge immediately before attaching it to customer).
但是 source 为您提供了更多选择,因为它是您在接受其他付款方式(例如支付宝或微信支付等)时唯一的选择,您不能将令牌 api 与卡以外的其他付款方式一起使用.正如@Daniel Winterstein 所说,令牌是 Stripe 的旧 API,而 Stripe 决定保留它只是为了向后兼容,但您应该使用源作为标准 API 来捕获使用付款详细信息.
But source gives you more option as it is the only option you have when accept other payment option such as alipay or wechat pay etc, you cannot use token api with other payment method other than card. As @Daniel Winterstein said that token was Stripe old API and stripe decided to keep it just for backward compatibility but you should use source as the standard API to capture use payment details.
这篇关于条纹支付:来源与令牌/卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!