【问题标题】:Cannot charge a customer that has no active card - Stripe Payment无法向没有活动卡的客户收费 - Stripe Payment
【发布时间】:2021-01-05 22:59:30
【问题描述】:

我正在尝试向已创建的客户收费,但出现错误 "无法向没有有效卡的客户收费"

卡片也已经添加了

这是我用来向客户收费的 node.js 代码

const response = await stripe.charges.create({
        'amount': amount,
        'currency': currency,
        'description': title,
        'customer': customer,
    }, { idempotencyKey: onDemandId });






// What I am sending
    {
      "amount": "40",
      "currency": "usd",
      "description": "120 دقيقة",
      "customer": "cus_I33Z2JrUSj1bBm"
    }


// What I am getting
    {
      "error": {
        "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"
      }
    }

知道为什么会出现此错误吗?

【问题讨论】:

    标签: node.js google-cloud-functions stripe-payments


    【解决方案1】:

    您应该检查客户是否有default_source,如果需要,请使用one of their saved cards 来检查set it

    更好的是,您应该查看creating payment using a saved card with Payment Intents,然后答案是您需要明确提供payment_method

    【讨论】:

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