Number of units per dollar. 1 unit = 1/10,000 of a dollar ($0.0001).
UNITS_PER_CENT
Number of units per cent. 1 cent = 100 units.
DEFAULT_MIN_TOP_UP
Default minimum top-up amount in units. 50,000 units = $5.00. Used when RouteConfig.minTopUp is not specified.
DEFAULT_CURRENCY
Default currency code. Used when RouteConfig.currency is not specified.
Utility Functions
unitsToCents(units: number): number
Converts units to Stripe cents, rounding up to the nearest cent.
Input (units)
Output (cents)
Dollars
1
1
$0.01
100
1
$0.01
101
2
$0.02
500
5
$0.05
50000
500
$5.00
The rounding-up behavior ensures the server never undercharges. For example, 1 unit ($0.0001) rounds up to 1 cent ($0.01) because Stripe doesn't support sub-cent charges.
unitsToDollars(units: number): string
Converts units to a human-readable dollar string. Trailing zeros and trailing decimal points are removed.
Input (units)
Output (string)
1
'0.0001'
100
'0.01'
500
'0.05'
10000
'1'
50000
'5'
12345
'1.2345'
This function is for display only — it returns a string, not a number.