Files
discourse/plugins/discourse-subscriptions/test/javascripts
Régis Hanol 77cd806b81 FIX: Round dollar-to-cents conversion in subscription plans (#37877)
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
2026-02-20 18:22:28 +01:00
..