【问题标题】:Stripe recurring payment integrate with masterpassStripe 定期支付与 masterpass 集成
【发布时间】:2021-06-13 12:07:13
【问题描述】:

有没有什么方法可以通过 Masterpass 使用 Stripe 进行定期付款?

Google pay 和 Apple pay 可以通过返回用于 Stripe 流程的卡令牌来使用 Stripe 进行定期付款。有没有办法用Masterpass获得这样的卡片令牌?

【问题讨论】:

    标签: stripe-payments token recurring card


    【解决方案1】:

    是的,您可以,您将使用从 Secure Remote Commerce(Masterpass 现在自己调用的)返回的数据创建一个 PaymentMethod,并使用它来开始订阅。

    遵循 Stripe 的 SRC 指南,然后当您到达“complete the payment”部分时,您可以这样做:

      // create the payment method
      const pm = await stripe.paymentMethods.create({
        type: 'card',
        card: {
          masterpass: {
            cart_id: cartId, // your unique cart ID
            transaction_id: req.query.oauth_verifier, // get this from the SRC callback URL
          },
        }
      });
    
      // create the Stripe customer
      const cust = await stripe.customers.create({
        payment_method: pm.id,
      });
    
      // create the subscription
      const sub = await stripe.subscriptions.create({
        customer: cust.id,
        items: [{
          price: {{PRICE_ID}},
        }],
        default_payment_method: pm.id,
      });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-12
      • 2014-11-28
      • 2023-03-03
      • 1970-01-01
      • 2019-01-20
      • 2018-12-17
      • 2020-02-26
      • 2015-05-19
      相关资源
      最近更新 更多