nenoDevelopers
⌘K
v1

Concepts

Amounts and currency

Every amount in the API is a string of digits in the currency's smallest unit. The currency is given separately.

Minor units

A minor unit is the smallest unit of a currency: cents for euros and dollars, pence for pounds. "totalMinor": "151250" with "currencyCode": "EUR" is €1,512.50. Fields that hold money end in Minor.

Why strings

Neno stores amounts as whole integers with no size limit. Most JSON parsers read numbers as floating point, which can round large values. A string arrives exactly as it was sent. Parse it into a decimal or big-integer type, never a float.

Examples

Currency Decimals In the API Means
EUR 2 "125000" €1,250.00
GBP 2 "4999" £49.99
JPY 0 "125000" ¥125,000
KWD 3 "125000" KWD 125.000

The number of decimals comes from ISO 4217. Look it up per currency rather than assuming two.

Formatting for display

Most platforms can do this for you. In JavaScript, Intl.NumberFormat knows each currency’s decimals:

JavaScript
// "151250", "EUR" → "€1,512.50"
function formatAmount(minor, currency, locale = "en-GB") {
const fmt = new Intl.NumberFormat(locale, { style: "currency", currency });
const digits = fmt.resolvedOptions().maximumFractionDigits;
return fmt.format(Number(minor) / 10 ** digits);
}

Quantities and rates

Quantities, tax rates and discounts are strings too, but they’re ordinary decimals, not minor units. An hour and a half is "1.5". A 21% VAT rate is "21", not "0.21".

Minor-unit fields only accept whole numbers. "unitPriceMinor": "1250.00" fails validation.