Stripe 无法向没有活动卡的客户收费
Stripe Cannot charge a customer that has no active card
我无法向 Stripe 客户收费。虽然这个问题过去已被问过十几次,但他们的错误 none 与我的问题相符。
我在 node.js 中调用此函数作为 firebase 函数
const charge = await stripe.charges.create({
customer : customerId,
amount : amount,
currency : currency
});
请求POST正文
{
"customer": "cus_JL4hVfDnym2SIk",
"amount": "500",
"currency": "usd"
}
我已确认 Stripe 仪表板上的所有值都是正确的。我也将测试卡存储在客户身上,它被明确设置为默认值,我也在仪表板上确认了这一点。我在一个非常不同的步骤存储卡信息,不像其他帖子一次处理所有这些。
我只想向帐户中有存储卡的客户收费。一切都在测试数据,测试卡等上。这是使用费用的问题吗api?还是测试卡因为某种原因不能在这里使用?
错误响应正文
{
"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"
}
}
仪表板中添加的卡片现在使用较新的 Payment Methods API. The pattern you're using depends on the customer having a default_source
(API ref) using the legacy Sources API。
你可以attach the test card as a source, but instead I'd suggest changing your integration to use Payment Intents.
如果客户已经添加了基础测试卡,需要提供其id
作为payment_method
:
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000,
currency: 'usd',
payment_method_types: ['card'],
payment_method: 'pm_123', // put your ID here
confirm: true,
});
虽然这适用于 4242 测试卡,但推荐的方法是 follow this guide to integrate with Stripe.js and Elements for client-side confirmation that supports Strong Customer Authentication。
我无法向 Stripe 客户收费。虽然这个问题过去已被问过十几次,但他们的错误 none 与我的问题相符。
我在 node.js 中调用此函数作为 firebase 函数
const charge = await stripe.charges.create({
customer : customerId,
amount : amount,
currency : currency
});
请求POST正文
{
"customer": "cus_JL4hVfDnym2SIk",
"amount": "500",
"currency": "usd"
}
我已确认 Stripe 仪表板上的所有值都是正确的。我也将测试卡存储在客户身上,它被明确设置为默认值,我也在仪表板上确认了这一点。我在一个非常不同的步骤存储卡信息,不像其他帖子一次处理所有这些。
我只想向帐户中有存储卡的客户收费。一切都在测试数据,测试卡等上。这是使用费用的问题吗api?还是测试卡因为某种原因不能在这里使用?
错误响应正文
{
"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"
}
}
仪表板中添加的卡片现在使用较新的 Payment Methods API. The pattern you're using depends on the customer having a default_source
(API ref) using the legacy Sources API。
你可以attach the test card as a source, but instead I'd suggest changing your integration to use Payment Intents.
如果客户已经添加了基础测试卡,需要提供其id
作为payment_method
:
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000,
currency: 'usd',
payment_method_types: ['card'],
payment_method: 'pm_123', // put your ID here
confirm: true,
});
虽然这适用于 4242 测试卡,但推荐的方法是 follow this guide to integrate with Stripe.js and Elements for client-side confirmation that supports Strong Customer Authentication。