#Zeel Darji
1 messages · Page 1 of 1 (latest)
👋 happy to help
yes this is due to floating precision in javascript
you should use parseInt(154.61 * 100)
Can I use (154.61 *100).toFixed(2)?
are we talking about PaymentIntents or Checkout?
PaymentIntents
So can I use toFixed(2)?
I mean you can charge 154.61 but not 154.6159
parseInt(154.61 * 100) will return string
not true
yep, you can
what I would suggest though is not using decimals at all, the amounts you store in your database/hard-code as the source for what your products cost should be stored the same way we accept(as integers in the smallest currency unit like cents), and then you wouldn't have this type of problem at all