【问题标题】:Cannot charge a customer that has no active card无法向没有活动卡的客户收费
【发布时间】:2022-01-27 20:35:45
【问题描述】:

所以我在 Stripe 中收到“无法向没有有效卡的客户收费”的错误。 我正在为此使用节点 js

付款代码如下

try {
    const customer = await stripe.customers.create({
      email: req.body.email,
      source: req.body.id,
    });

    const payment = await stripe.charges.create(
      {
        amount: req.body.totalAmount * 100,
        currency: "inr",
        customer: customer.id,
        receipt_email: req.body.email,
        confirm: true,
        off_session: true,
      },
      {
        idempotencyKey: uuidv4(),
      }
    );

我收到以下错误

type: 'StripeCardError',
  raw: {
    code: 'missing',
    doc_url: 'https://stripe.com/docs/error-codes/missing',
    message: 'Cannot charge a customer that has no active card',
    param: 'card',
    type: 'card_error',
}

【问题讨论】:

    标签: javascript node.js mongodb stripe-payments mern


    【解决方案1】:

    注销req.body.id,因为那可能是null,然后调查为什么您的前端没有将该参数传递给您的后端。

    其次,confirmoff_session 不是 /v1/charges 端点上支持的参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-05
      • 2016-12-15
      • 2017-03-17
      • 1970-01-01
      • 2017-11-05
      • 1970-01-01
      • 2015-05-25
      相关资源
      最近更新 更多