Monetary amounts must be sent to Ravelin in the currency’s ISO 4217 minor units.
For example, for US dollars, to specify $10.50 (USD), you should send 1050
.
{
"currency": "USD",
"amount": 1050
}
Other currencies, such as the Japanese Yen, or the Vietnamese Dong, are not considered in their minor units.
For example, to specify ¥300 (JPY), you should send 300
.
{
"currency": "JPY",
"amount": 300
}
The Malagasy ariary and the Mauritanian ouguiya are both subdivided into fifths, and so the amount should be multiplied by 5 before sending to Ravelin.
For example, to specify 1.2 ouguiya (MRU), you should send 6
.
{
"currency": "MRU",
"amount": 6
}
Ravelin uses the transformations defined by the exponents in ISO 4217, interpreted as:
func CurrencyToBasicMultiplier(currency string) int {
switch currency {
case "BIF", "CLP", "CVE", "DJF", "GNF", "ISK", "JPY", "KMF",
"KRW", "PYG", "RWF", "UGX", "UYI", "VND", "VUV", "XAF",
"XOF", "XPF":
return 1
case "MGA", "MRU":
return 5
case "BHD", "IQD", "JOD", "KWD", "LYD", "OMR", "TND":
return 1000
}
return 100
}
Note, ISO 4217 differs from both the “Number to basic” column from Wikipedia - List of Circulating Currencies, and the POSIX standard in different places. It may also differ from your PSP’s handling of these currencies. For example, Braintree handles the Lao kip (LAK) without subdivision, while ISO 4217 and Stripe do.
Was this page helpful?