Stripe 抛出无效的整数错误 [英] Stripe throws invalid integer error

查看:98
本文介绍了Stripe 抛出无效的整数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法以条纹方式收取 49.99 美元的费用.我正在浏览以下链接,但没有锻炼

I am unable to charge the amount $49.99 in stripe. I am going through the following links but nothing workout

条纹结帐价格错误 - 整数无效

Stripe Rails:无效整数:1.06

我想按原样收取金额.我不想四舍五入付款

I would like to charge the amount as it is. I don't want to round off the payment

 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 只允许在 price 中使用整数值,因此需要将您的价格(金额)更改为 (*100 ) 分,所以现在您的代码金额为 499 并且在条带中sdashboard 您会看到 49.99 以获取更多详细信息,请查看链接:

Stripe allow only integer value in price so need to change your price (amount) into cent by (*100 ) so now your code amount is 499 and in stripe sdashboard you see the 49.99 for more details check the link :

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

这篇关于Stripe 抛出无效的整数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆