sepa_debit 条纹订阅的付款方式无效

sepa_debit payemnt method with stripe subscriptopn doesn't work

我将 Stripe 与 react-native 一起使用,我想按照 tutorial

中所述将 PaymentIntent 与 Subscription 集成

问题是我无法在 front-end 中将 SEPA 显示为有效的付款选项。 Stripe 在他们的 subscription API docs 中提到您可以像在 payment_intent 中那样传递 payment_method_types。然而,它似乎不起作用!

让我举例说明

const paymentIntent = await stripe.paymentIntents.create({
    amount: 1099,
    currency: 'EUR',
    customer: customer.id,
    payment_method_types: ["card", "sepa_debit"]
  });

  return res.json({
    // @ts-ignore
    paymentIntent: paymentIntent.client_secret,
    ephemeralKey: ephemeralKey.secret,
    customer: customer.id,
  });

结果就像您看到的 SEPA 选项一样

  const subscription = await stripe.subscriptions.create({
    customer: customer.id,
    items: [{
      price: "price_1JwZ4tJyYehXW8ayueOKGDUM",
    }],
    payment_settings: {
      payment_method_types: ["card", "sepa_debit"]
    },
    payment_behavior: 'default_incomplete',
    expand: ['latest_invoice.payment_intent'],
  });

  return res.json({
    // @ts-ignore
    paymentIntent: subscription.latest_invoice.payment_intent.client_secret,
    ephemeralKey: ephemeralKey.secret,
    customer: customer.id,
  });

结果就像(没有 SEPA 选项)

知道为什么 sepa_debit 使用 payment_intent 而不是订阅吗?

订阅创建期间生成的付款意向会自动设置setup_future_usage: off_session以确保保存的付款方式可用于将来的会话外定期付款。

查看 Stripe 的 React Native SDK 的代码,它似乎依赖于 Android 和 iOS 中的逻辑来确定何时将 sepa_debit 作为一个选项显示在付款 Sheet。这两个 SDK 目前都不支持 sepa_debit 设置 setup_future_usage 的付款意向,这解释了为什么您没有看到它显示为订阅付款意向的选项。您可以在此处查看我引用的代码: