Money is not always cents
Most developers internalise "amount × 100" for money because their home currency has two decimal places. The Japanese yen has none — ¥1,235 is a whole number, not 1,235 cents. The Kuwaiti dinar has three. Bahrain, Oman, Tunisia and a handful of others also use three. Assume two and you will charge a Japanese customer 100× too much, or a Kuwaiti 1/10th too little.
ISO 4217 and ICU disagree sometimes
The authoritative minor-unit count lives in ISO 4217, and ICU/CLDR usually matches it — but not always, and hyperinflation currencies drift. LocaleSense returns the real minor-unit count per market and re-derives its formatting from ICU on every build, so a currency that changes convention breaks the build instead of silently shipping a wrong charge.
The safe rule
Never hard-code the number of decimal places. Read it per currency, store money as an integer count of minor units or as a decimal string, and never as a float — a float cannot represent 0.10 exactly, and money math on floats accumulates error.
Keep reading_
More from the blog
The BIN-vs-IP mismatch: the fraud signal a geo API can’t give you
A card issued in one country, presented from an IP in another, is one of the strongest cheap fraud signals — and no geolocation API surfaces it.
Read postCentral-bank FX vs reseller rates: provenance you can name
When you quote a customer an exchange rate, can you say where it came from? Central-bank rates are public, free and defensible.
Read post