Money in the Reevit API is always an integer in the currency’s minor
unit — the smallest indivisible unit of that currency. There are no decimal
points anywhere in the API, which makes floating-point rounding bugs
structurally impossible.
Rules
- Send integers.
45000, never 450.00. A request with a fractional
amount is rejected.
- Convert at the edge using the currency exponent. GHS and USD use two
decimal places, XOF uses zero, and KWD uses three. Validate form input before
converting it; keep the resulting integer throughout your system.
- Every money field follows the same rule.
amount, fee_amount,
net_amount, refund amounts, payout amounts, and settlement amounts are
all minor-unit integers in their stated currency field.
- Sum only amounts in the same currency. Keep money as integers, group by
its stated currency, then format each group. A settlement preference does not
convert an original-currency amount.
The published @reevit/core@0.9.1 exports toMinorUnits and currencyExponent.
Its published toMinorUnits(major, currency) signature accepts a number and
rounds it after multiplying by 10 ** currencyExponent(currency). It does not parse decimal
strings or provide exact decimal arithmetic. Validate the input’s precision for
the currency before conversion; use a decimal parser when exact form-input
conversion is required.
The formatter may use a localized currency symbol and spacing. Every checkout
input and callback amount remains a minor-unit integer in its stated currency;
provider-specific conversion belongs inside the SDK bridge.
The SDKs keep you honest: their typed payment-intent builders take
minor-unit integers, and the docs’ code samples annotate them — e.g.
amount: 45000, // GHS 450.00, in pesewas.