gpt4 book ai didi

node.js - Stripe 抛出无效整数错误

转载 作者:搜寻专家 更新时间:2023-10-31 23:31:18 27 4
gpt4 key购买 nike

我无法在 strip 中收取 49.99 美元的金额。我正在浏览以下链接,但没有任何锻炼

Stripe Checkout Price error - Invalid Integer

Stripe Rails: Invalid integer: 1.06

我想按原样收款。我不想四舍五入付款

 stripe.charges.create({
// Charge the customer in stripe
// amount: req.query.amount,
amount: 49.99,
currency: 'usd',
customer: req.customer
}).then(function(charge) {
// Use and save the charge info in our db
var successTransaction = {
stripeId: charge.customer,
transactionId: charge.id,
amount: charge.amount,
currency: charge.currency,
message: charge.outcome.seller_message,
paidStatus: charge.paid,
summary: charge
};

最佳答案

Stripe 只允许价格中的整数值,因此需要将您的价格(金额)更改为美分(*100),所以现在您的代码金额为 499,在 stripe 仪表板中您会看到 49.99 以获取更多详细信息,请查看链接:

https://stripe.com/docs/api#charges

In other words, Stripe's API always takes smallest supported unit as input (without need to configure anything), for example, amount of 1 means 1-Cent not 1-Dollar.

关于node.js - Stripe 抛出无效整数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45453090/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com