【发布时间】:2017-09-12 19:45:50
【问题描述】:
我想使用 Stripe 每 30 天以浮动的金额定期向卡收费。
从我得到的文档中,如果卡有可能需要 3DS,我们应该使用 Sources,所以我切换到 Sources ;)
从stripe.js 检索的源对象中,我查看three_d_secure 参数来决定是否创建需要3DS 或普通卡充电的源对象。
流程:
使用 JS,我得到了将 three_d_secure 设置为 optional 或 required 的源对象。
当我使用source = Stripe::Source.retrieve(source_id) 检索源后将其设置为 可选 时,它看起来像这样:
"status": "chargeable",
"type": "card",
"usage": "reusable",
"card":{"exp_month":12,"exp_year":2032,"brand":"Visa",...
给顾客安装,收费。我猜usage: reusable的意思是我可以稍后再充卡……
当three_d_secure=='required' 我创建一个新的source 调用这个:
source = Stripe::Source.create({
amount: amount,
currency: currency,
type: 'three_d_secure',
three_d_secure: {
card: source_id, #src_xcvxcvxcvc
},
redirect: {
return_url: return_url
},
})
我将用户重定向到 Stripe 提供的 URL,用户输入他的 3DS PIN 并返回到我的return_url。当 Stripe 将用户重定向回我的 return_url 时,我再次检索源并得到如下内容:
"status": "chargeable",
"type": "three_d_secure",
"usage": "single_use",
"three_d_secure": {"card":"src_1B1JzQHopXUl9h9Iwk05JV1z","authenticated":true,"customer":null}
我希望在通过 3DS 之后,源可以重复使用和收费,直到到期日期左右:|
我的问题是:
1 为什么 3DS 源是单一用途的?是只在sanbox环境下还是在我用来测试的卡上这样?
2 受 3DS 保护的卡可以再次充电吗?
3 附加到可反复收费的客户来源(3DS 或普通)的正确方法是什么?
谢谢!
【问题讨论】:
标签: stripe-payments