Skip to content

Money

Ele writes every amount as a decimal number in a JSON string, never as a JSON number:

{ "amount": "1234.50", "currency": "USD" }

A JSON number passes through floating point in most languages, and floating point cannot hold most decimal fractions exactly. A string keeps the exact value. Send amounts as strings too. A request that sends a number where the reference says string is refused with 422 invalid_request.

Newer fields pair the amount and its currency in one object, as above. Older fields keep them side by side, such as amount and currency, or fee_amount and fee_currency. Either way, never read an amount without its currency.

A few fields are JSON numbers rather than strings. The reference page for each says which unit it uses:

  • Card spending limits, such as a card’s monthly_limit, are whole numbers. So is the card_limit you may set when you invite a member, although the schema allows a fraction there: send a whole number. It is in whole US dollars, and an invitation’s approval request shows the same value.
  • annual_income in the business revenue form (submitKybRevenueFunds) is a JSON number: send it as a number, not a string. It describes the business for its checks; it is not an amount Ele moves.
  • The onboarding forms’ decimal_value is a JSON number on submitOnboardingRequirement, and may be a number or a string on submitOrganizationProfileGap. Prefer the string there.

Each currency has a fixed number of decimal places:

Currency Decimal places Example
Most currencies, such as USD, EUR, GBP 2 "10.50"
JPY and other currencies without minor units 0 "1500"
BHD and other currencies with three 3 "1.250"
USDC, USDT 6 "10.500000"
Other crypto, such as SOL or ETH The token’s own precision: SOL 9, ETH 18 "0.250000000"
ELEPOINTS (reward points) 6 "120.000000"

Fiat currencies follow ISO 4217.

Do not send more decimal places than the currency allows. Ele refuses an amount such as "10.505" USD rather than rounding it. Trailing zeros are fine: "10.5000" USD means 10.50.

Ele may return an amount with more trailing zeros than you sent, such as "10.50" for "10.5". Compare amounts as decimal numbers, not as strings.

Where an amount depends on a conversion or a fee, Ele works it out and returns the result. Show the amounts Ele returns, such as a quote’s totals, rather than working them out again yourself.

Fiat currencies use their three-letter ISO 4217 code in capitals, such as USD, EUR or SGD.

Stablecoins such as USDC and USDT appear on crypto payments and deposits. An organization does not keep a stablecoin balance: crypto deposits are credited to it in US dollars.

ELEPOINTS is the code for reward points. Points are not money; do not add them to money totals.

To see which currencies an organization can hold, receive and send, call listOrganizationCurrencies. getOrganizationBalance returns a balance for each currency it holds.

  • Never parse an amount into a float64, a JavaScript number or any other binary floating-point type.
  • In Go, keep amounts as strings and use a decimal library for arithmetic. math/big.Rat from the standard library works too: r, ok := new(big.Rat).SetString("10.50").
  • In your database, store amounts as NUMERIC/DECIMAL columns or as strings, with the currency beside them.
  • When you display an amount, format it from the decimal value and its currency.