Stripe throws invalid integer error

Viewed 20452

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

Stripe Checkout Price error - Invalid Integer

Stripe Rails: Invalid integer: 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
    };
3 Answers

You can use the following method as it will help you to use the decimal value as the amount and display the same amount in the invoice and during payment.

amount: Math.round(49.99 * 100)

Stripe allows integer value as price, if you want to charge $49.99 then multiply it with 100.

Smallest price unit allowed by stripe is cent.

599 cents = $5.99

Related