首页 文章

3DS源的条带定期付款

提问于
浏览
0

我想使用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提供的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源是single_use?这是仅在sanbox环境中使用或者使用我用来测试的卡吗?

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

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

谢谢!

1 回答

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

    • 如果3ds是 optionalnot_supported 则为是,如果 required 则为否 . 如果 required 那么每个payement都需要满足3ds .

    • 步骤:

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

    • 使用 src_card_token 中的src创建 customer object

    • 使用他保存的一张卡(作为代币)为客户创建 src_payment_token

    如果需要,

    • fullfil 3ds重定向过程 .

    • 创建一个充电

相关问题