fix payment rounding error (#1193)

<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved pricing accuracy by implementing proper rounding in unit
price calculations during checkout. This ensures correct cent-level
precision in purchase computations, preventing potential rounding errors
in transaction totals.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
BilalG1 2026-02-12 16:52:07 -08:00 committed by GitHub
parent 621ada20a0
commit 6673e63ee7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,7 +48,7 @@ export default function PageClient({ code }: { code: string }) {
if (!selectedPriceId || !data?.product?.prices) {
return 0;
}
return Number(data.product.prices[selectedPriceId].USD) * 100;
return Math.round(Number(data.product.prices[selectedPriceId].USD) * 100);
}, [data, selectedPriceId]);
const MAX_STRIPE_AMOUNT_CENTS = 999_999 * 100;