For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quantity & price representation

Every amount, percentage and quantity is an integer with two implied decimals.

This is the single rule that breaks the most integrations, so it is worth two minutes.

All amounts, percentages and quantities in the API are integers, where the value carries two implied decimal places. There are no floating-point numbers anywhere in the API.

Sent or received
Means

100

1.00

1299

12.99

2500

25.00

-150

-1.50

Why integers

  1. No rounding errors. Floating-point arithmetic introduces small inaccuracies that are unacceptable for money, and just as unacceptable for stock levels that have to reconcile.

  2. One consistent scale. Every amount on every endpoint uses the same fixed two decimals, so there is never a per-field question about precision.

  3. Portable across languages. Languages and databases disagree about how to represent decimals. They agree about integers.

Converting

Reading from the API — divide by 100:

const amountMinor = 2500;          // from the API
const amount = amountMinor / 100;  // 25.00

Sending to the API — multiply by 100 and round explicitly:

const amount = 25.00;                             // in your application
const amountMinor = Math.round(amount * 100);     // 2500 for the API

The Math.round is not decoration. 19.99 * 100 is 1998.9999999999998 in JavaScript, and truncating gives you 1998 — a one-øre error that will surface in reconciliation weeks later.

In a language with a decimal type, prefer that over floats for the intermediate value, and convert to integer only at the boundary.

It applies to percentages and quantities too

The same fixed scale covers more than money:

Quantities being scaled the same way is easy to miss. A quantity of 1 is 0.01 units, not one unit. One unit is 100.

In short

Direction
Do

API to your app

divide by 100

Your app to API

multiply by 100, then round

Anywhere

never send a decimal point

Was this helpful?