无法在Stripe中检索客户的付款方式

问题描述 投票:0回答:1

我在 Stripe 中创建了客户和付款意向,打算在付款意向初步完成后向客户收费。根据这篇文章,我所要做的就是将客户 ID 添加到付款意图中,并将

setup_future_usage : 'off_session',
添加到付款意图对象中。然后我应该可以稍后调用付款意向并进行收费。

运行测试付款时,我可以在 Stripe 仪表板中看到未来的使用付款意图。 payment intent future use

但是当我调用客户的付款方式时,我得到一个空数组。

尝试#1

const paymentMethods = await stripe.paymentMethods.list({
  customer: customerId,
  type: "card",
});

尝试#2

const paymentMethods = await stripe.customers.listPaymentMethods(
      customerId,
      {
        type: "card"
      },
    );

回复空列表:empty response

Stripe 日志还显示这些尝试以及正确的客户 ID。

node.js stripe-payments stripe-payment-intent
1个回答
0
投票

我找到了解决办法。如果我使用 Stripe 客户 ID 创建付款意向,我只能将付款方式自动附加到客户。之前,我的客户 ID 已通过更新添加到付款意向中。

© www.soinside.com 2019 - 2024. All rights reserved.