[英]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.