mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
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:
parent
621ada20a0
commit
6673e63ee7
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user