[英]Cannot charge a customer that has no active card
So I am getting the error in Stripe that "Cannot charge a customer that has no active cards".因此,我在 Stripe 中收到“无法向没有活动卡的客户收费”的错误。 I am using node js for this我为此使用节点 js
Payment Code is given below付款代码如下
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(),
}
);
And I am getting the following error我收到以下错误
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',
}
Log out req.body.id
as that might be null
and then investigate why your frontend is not passing that parameter to your backend.注销req.body.id
,因为它可能是null
,然后调查为什么您的前端没有将该参数传递给您的后端。
Second, confirm
and off_session
are not supported parameters on the /v1/charges
endpoint.其次, confirm
和off_session
不是/v1/charges
端点上支持的参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.