Technical concepts
Money and currencies
Every amount is an integer in the minor unit of its currency. The API never uses decimal numbers for money.
Minor units#
An amount is an integer in the smallest unit of the currency. For the euro, the minor unit is the cent.
| Amount | Currency | Value |
|---|---|---|
14280 |
EUR |
€142.80 |
500 |
EUR |
€5.00 |
1000 |
JPY |
¥1000. The yen has no minor unit. |
Currency codes#
A currency is an ISO 4217 alphabetic code in upper case, for example EUR. The pattern is ^[A-Z]{3}$.
Two shapes of amount#
The API uses two shapes, depending on the resource.
On transactions, an amount is a plain integer. The currency is the currency field of the transaction:
{
"currency": "EUR",
"amounts": { "subtotal": 12000, "discount": 0, "net": 12000, "tax": 2280, "total": 14280 },
"remainingCollectibleAmount": 14280
}On payments, refunds, and checkout sessions, an amount is a Money object with its own currency:
{ "amountMinor": 14280, "currency": "EUR" }Payment links use plain integers with a Minor suffix, such as amountMinor and minimumAmountMinor, next to a currency field.
Webhook payloads use plain integers, with a currency field on the object.
Rules#
- A transaction has one currency. Every line must use a price in that currency. Otherwise the request returns
422withcurrency_mismatch. - A transaction amount can be
0. A payment amount must be greater than0. - A refund must use the currency of the payment, and cannot be more than the amount that is not yet refunded.
- Merxian calculates the tax and the total of a transaction from catalog prices. Read the amounts from the response. Do not calculate the total yourself. See Transactions.