mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 02:59:07 +08:00
Setting a subscription price like $19.99 would fail with "Invalid
integer 1998.9999999999998" from the Stripe API.
Due to IEEE-754 floating point arithmetic, `parseFloat("19.99") * 100`
produces `1998.9999999999998` instead of `1999`. This non-integer value
is then sent directly to Stripe which rejects it.
Wrapping the multiplication in `Math.round()` ensures the result is
always a proper integer before being stored as `unit_amount`.
https://meta.discourse.org/t/393466
|
||
|---|---|---|
| .. | ||
| javascripts/discourse | ||
| stylesheets | ||