[英]Which payment method to use for Stripe Payment intent
我正在尝试在 NodeJS 中自动向客户收费
我有一个问题,一些客户有:
我当前的工作流程(C# WPF):
这工作正常,付款运行良好。
我还使用 nodejs api 收取短信费用:
async function chargeSMS(stripeCusID,chargeValue,chemistName,chemistID,countSMS){
//console.log(stripeCusID);
//console.log(chargeValue);
let customerObject;
let payMethodID;
customerObject = await stripe.customers.retrieve(
);
console.log("PaymentID received:" + customerObject.invoice_settings.default_payment_method);
payMethodID = customerObject.invoice_settings.default_payment_method;
await stripe.paymentIntents.create({
amount: chargeValue,
currency: 'aud',
customer: stripeCusID,
description: 'SMS Charges: ' + countSMS + " sent",
payment_method: payMethodID,
confirm: true
},
function(err, response) {
if (err) {
console.log("Charge", err.message,stripeCusID,chargeValue,chemistName);
return;
}
console.log("Successful SMS Charge:", response.id,chemistName);
chemCharged(chemistID);
})
}
这在每个月的 1 日作为 Cron 也运行良好。
我的问题是最近我的一张客户卡过期了。 他们使用我的 WPF 打开门户并添加新卡这工作。
但是,门户网站上的这张新卡仅列为 customer.default_source
他们的 invoice_settings.default_payment_method
现在为空!
所以我上面的代码失败了。
我已经检查过并且:
我不知道为什么会出现这种情况,但我使用的是条纹客户门户,所以我原以为他们会以同样的方式添加!
有什么想法可以解决这个问题或找出我做错了什么吗?
在条带 web 门户(我的业务)上,我可以看到该客户确实有一张默认卡,并且看起来与任何其他客户相同,但 api 方面已将其注册在不同的部分下!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.