为什么保存的条纹卡仅在源中而不是卡中? [英] Why is saved stripe card only in sources and not cards?

查看:19
本文介绍了为什么保存的条纹卡仅在源中而不是卡中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Stripe 中保存了我的信用卡,但为什么它只在来源中

I saved my credit card in Stripe but why is it only in sources

而不是在卡片之下?

我使用了文档中指定的 stripe.customers.createSource 来保存卡片 (https://stripe.com/docs/api#create_card)

I have used stripe.customers.createSource as specified in the docs to save a card (https://stripe.com/docs/api#create_card)

我想这就是 stripe.customers.listCards 什么都不返回的原因

I guess this is the reason why stripe.customers.listCards return nothing

推荐答案

库中的方法 stripe.customers.createSource 只是向 /v1/customers/cus_123 发出 POST 请求/sources 向其添加源.源本身的类型取决于您用于在客户端创建它的内容.

The method stripe.customers.createSource in the library is just making a POST request to /v1/customers/cus_123/sources to add a source to it. The type of the source itself depends on what you have used to create it client-side.

如果您创建卡片 令牌 客户端 tok_123获取客户的 卡片对象 card_123.如果您在美国使用 ACH 借记并创建了一个银行账户,您还可以获得一个银行账户对象令牌 btok_123.这是 API 中已存在多年的遗留方法.

If you create card Tokens client-side tok_123 you will get Card object card_123 on the customer. You could also get a Bank Account object if you use ACH debits in the US and created a bank account tokens btok_123. This is the legacy method that has existed for years in the API.

最近,Stripe 发布了一个名为 Source 的新高级对象,您可以阅读在文档中详细了解来源.无论使用哪种付款方式(卡、SEPA 借记卡、支付宝、Sofort 等),这都允许您拥有一个独特的对象.这使得处理代码中的逻辑变得更加容易,因为对象具有相同的形状和特定于每种付款方式的属性,它们存在于您知道以不同方式处理的子哈希中.这些 Source 对象的 ID 格式为 src_123.

More recently, Stripe release a new high-level object called a Source and your can read more about Sources in the documentation. This allows you to have one unique object no matter the payment method used (card, SEPA debit, Alipay, Sofort, etc.). This makes handling the logic in your code a lot easier as the objects have the same shape and properties specific to each payment method live in a sub-hash that you know to handle differently. Those Source objects have an id in the format src_123.

在这里,您的客户附加了来源.这意味着客户端,当您收集卡详细信息时,您正在主动创建源而不是令牌.这是由于您用于创建它的方法/调用.在 Elements 中,您将使用 createSource() 而不是 createToken() 而在移动 SDK 中,他们会默认创建源.

Here, your customer has Sources attached to it. This means that client-side, when you collect the card details, you are actively creating a Source instead of a Token. This is due to the methods/calls you use to create it. In Elements you would be using createSource() instead of createToken() while in the mobile SDKs they would create Sources by default.

最终,Sources 是一种更好的新集成方法,因为它们更具可扩展性,并且可以在未来处理您的国际业务增长.我建议让 Sources 继续前进.

Ultimately, Sources are a better approach for a new integration as they are more scalable and can handle the growth of your business internationally in the future. I'd recommend keeping Sources moving forward.

这篇关于为什么保存的条纹卡仅在源中而不是卡中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆