[英]Cannot charge a customer that has no active card
因此,我在 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',
}
注銷req.body.id
,因為它可能是null
,然后調查為什么您的前端沒有將該參數傳遞給您的后端。
其次, confirm
和off_session
不是/v1/charges
端點上支持的參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.