Skip to content
Astera Technology

Preserve currency units in an API amount field

Bind each integer amount to its currency and operation-specific representation.

Map currency before scaling

Stripe documents minor-unit amounts, zero-decimal currencies and special cases. This does not make every provider’s amount convention identical. The examples compare two ordinary documented charge representations; they do not state fees, currency availability or exchange rates.

Synthetic amount field map
Display amountCurrencyInteger representationCheck
HK$10.99hkd1099 minor unitsTwo-decimal representation for this example
¥500jpy500 minor unitsZero-decimal charge representation
10.99 without currencyMissingUnresolvedReject or review; do not assume HKD
Download editable CSV ↓

Keep rounding and operation type explicit

Use decimal-safe conversion, reject excess precision according to the agreed rule and keep currency beside the amount at every stage. Charges and payouts may have different special rules. Do not use binary floating-point multiplication as the sole validation of monetary input.

Can a shared adapter multiply every displayed amount by 100?

Show the worked answer

No. JPY in the documented charge example would be wrong. Resolve currency and operation rules first; keep special cases in a reviewed mapping with tests.

Related resources