Currency Codes
Supported currencies and formatting
Currency Codes
Supported currencies and how to format amounts.
Amount format
Amounts are specified in the smallest currency unit (e.g., cents):
| Currency | Amount | Meaning |
|---|---|---|
| KZT | 5000 | 50.00 ₸ |
| USD | 5000 | $50.00 |
| EUR | 5000 | 50.00 |
| GBP | 5000 | 50.00 |
| JPY | 5000 | 5,000 |
Converting amounts
// Convert display amount to API amount
function toSmallestUnit(amount, currency) {
const zeroDecimal = ['JPY', 'KRW', 'VND', 'BIF', 'CLP', 'GNF', 'KMF', 'MGA', 'PYG', 'RWF', 'UGX', 'XAF', 'XOF', 'XPF'];
if (zeroDecimal.includes(currency)) {
return Math.round(amount);
}
return Math.round(amount * 100);
}
// $50.00 USD
const amount = toSmallestUnit(50.00, 'USD'); // 5000
// 5000 JPY
const amountJpy = toSmallestUnit(5000, 'JPY'); // 5000Formatting for display
function formatCurrency(amountInSmallestUnit, currency) {
const zeroDecimal = ['JPY', 'KRW', 'VND'];
const divisor = zeroDecimal.includes(currency) ? 1 : 100;
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: currency
}).format(amountInSmallestUnit / divisor);
}
formatCurrency(5000, 'USD'); // "$50.00"
formatCurrency(5000, 'JPY'); // "5,000"Minimum amounts
Each currency has a minimum charge amount:
| Currency | Minimum |
|---|---|
| USD | $0.50 |
| EUR | 0.50 |
| GBP | 0.30 |
| JPY | 50 |