是否可以 programmatically/off-session 在没有 SetupIntent 的情况下向用户收费,仅使用从他们的第一个 PaymentIntent 获得的详细信息?

Is it possible to programmatically/off-session charge users without SetupIntent, with only the details got from their first PaymentIntent?

我们有一个网站交给我们,第一次使用 PaymentIntent 向用户收费。

但是 我们希望将来无需用户再次填写表格或即使他们处于离线状态也能向用户收费。所以希望通过 API,我们可以以编程方式再次向他们收费。

如果我错了请纠正我,但是如果第一次付款时没有创建 SetupIntent,我们以后就不能再向他们收费了,对吗?即使网站从第一笔付款中节省了 customer IDpaymentIntent IDpaymentMethod ID

我仍然是 asking/hopeful 因为我注意到这两件事:

  1. 他们将 setup_future_usage 配置为 off_session,但我不确定这对这种情况是否真的有帮助?
  2. 我注意到即使没有创建 SetupIntent,如果用户使用信用卡付款,我们仍然可以通过 Stripe 管理面板再次向他们收费: 这实际上是他们目前用来向用户再次收费的。但是我们想 automatically/bulk 从我们自己的 website/dashboard 开始。我正在检查我们是否可以通过 API 或从我们的服务器以编程方式执行此操作?

我希望有人能提供帮助。谢谢!

如果您不使用 Checkout Session,则有两种方法可以创建可重复使用的 PaymentMethod:

  1. 创建一个 SetupIntent,如 Stripe doc here 中所述。
  2. 创建一个设置了 setup_future_usage 的 PaymentIntent,如 Stripe doc here. Note that setup_future_usage has two possible values: on_session and off_Session 中所述。

根据您的描述,您的实施似乎是使用带有 setup_future_usage=off_session 的选项 2。因此,它允许您稍后通过仪表板和 API.

向客户收费

文档涵盖 how to charge a PaymentMethod off-session with the API。但总而言之,你需要做这样的事情(在 Node.js 中):

const paymentIntent = await stripe.paymentIntents.create({
  // Set the amount and currency
  amount: 1000,
  currency: 'aud',
  
  // Pass the existing PaymentMethod and Customer
  payment_method: 'pm_xxx',
  customer: 'cus_xxx',

  // Tell Stripe to try to automatically confirm the payment
  confirm: true,
  off_session: true,
});