Money and amounts
Every amount is a decimal string in major units. Never a number.
Applies to the new routes.
Every amount is a string in major units, with exactly the currency's number of decimals:
{ "amount": "1000.00", "currency": "USD" }
{ "amount": "5000", "currency": "XOF" }
{ "amount": "1500000.00", "currency": "NGN" }
- A JSON number in an amount field is refused:
400 VALIDATION_ERROR, withissue: "must_be_decimal_string". - More decimals than the currency allows is refused, never rounded silently.
- Amounts are shown in the currency they are held in. Any converted value is secondary and marked as approximate.
- Fees and rates are always returned by us (in a quote or on the resource). You never send a rate or a fee.
- Rounding happens once, when we make the quote, half up to the currency's smallest unit.
- Collection amounts in local currencies are whole units, rounded up. A local amount you type is kept exactly.
- Rates are decimal strings too (
"rate"on a quote or payout).
In your code
Parse amounts with a decimal library or as integer minor units. Don't convert them to floating-point numbers.
// "1000.00" USD → 100000 cents, without floats
const [whole, frac = ""] = "1000.00".split(".");
const minor = BigInt(whole) * 100n + BigInt(frac.padEnd(2, "0"));
Quotes
POST /v1/quoteswithintent: "payout"or"convert".- The quote holds the amounts, the rate, our fee, any platform fee, the total and
expiresAt. - Use it once, for its intent only: a payout quote creates one payout; a convert quote one conversion.
- Expired →
409 QUOTE_EXPIRED: make a new quote. Used →409 QUOTE_ALREADY_USED. Wrong intent →422 QUOTE_INTENT_MISMATCH.
Quotes last 5 minutes (payout) and 60 seconds (convert). Transfers between Storspay accounts in the same currency need no quote.
September v1 API
The September v1 API sends and returns amounts as numbers (for example amountUsd), exactly as it was specified. It does not change. Use the new routes for decimal strings.