Merge pull request #28270 from overleaf/kh-add-stripe-payment-context

[web] add stripe payment context

GitOrigin-RevId: 79dfbb1da0dd6b1d36c68c86debffc1edb169961
This commit is contained in:
Kristina
2025-09-16 08:05:45 +00:00
committed by Copybot
parent 7b3c2b838d
commit c79cc52fcf
7 changed files with 68 additions and 16 deletions
@@ -26,3 +26,19 @@ export function formatCurrency(
return `${currency} ${amount}`
}
export function convertToMinorUnits(amount: number, currency: string): number {
const isNoCentsCurrency = ['clp', 'jpy', 'krw', 'vnd'].includes(
currency.toLowerCase()
)
// Determine the multiplier based on currency
let multiplier = 100 // default for most currencies (2 decimal places)
if (isNoCentsCurrency) {
multiplier = 1 // no decimal places
}
// Convert and round to an integer
return Math.round(amount * multiplier)
}