[英]StripeCardError: Cannot charge a customer that has no active card. Trying to make a payment using Stripe
[英]Cannot charge a customer that has no active card - Stripe Payment
我正在尝试向已创建的客户收费,但出现错误“无法向没有活动卡的客户收费”
卡也已经添加了
这是我用来向客户收费的 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"
}
}
知道为什么我会收到此错误吗?
您应该检查 Customer 是否有default_source
,并在需要时使用他们保存的卡片之一进行设置。
更好的是,您应该考虑使用带有 Payment Intents 的已保存卡创建付款,然后答案是您需要明确提供payment_method
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.