3DS源的条带定期付款

时间:2017-09-12 19:45:50

标签: stripe-payments

我想使用Stripe每隔30天反复收取一次卡片的费用。

从我得到的文档中,如果卡片有可能需要3DS,我们应该使用Sources,所以我切换到了源码;)

从源对象stripe.js检索我查看three_d_secure param以决定是否创建需要3DS或普通卡充电的源对象。

流程:

使用JS,我得到的源对象three_d_secure设置为可选必需。 在我使用: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提供的网址,用户输入他的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源是single_use?这只是在sanbox环境中或者用我测试的卡片吗?

2 3DS保护卡可以再次充电吗?

3什么是连接到客户来源(3DS或正常)的正确方法,可以反复收费?

谢谢!

1 个答案:

答案 0 :(得分:1)

  1. 因为它是source payment token,而不是source card token。它在到期日或消费时到期。您可以使用reusable令牌创建single_use令牌。 reusable一个代表card source token

  2. 如果3ds为optionalnot_supported,则为是,如果required则为否。如果required则每个付款都需要满足3ds。

  3. 步骤:

    • 为卡片创建src_card_token或使用已保存的卡片(reusable

    • 使用customer object

    • 中的src创建src_card_token
    • 使用其中一张已保存的卡片(作为代币)为客户创建src_payment_token

    • 如果需要,请填写3ds重定向流程。

    • 制作费用

相关问题