# Money

> Amounts are integers in minor units, always with a currency.

Source: https://developers.loyx.se/guides/money/

Every amount in the API is an **integer in the currency's minor unit**, paired with an ISO 4217 currency code.

| You mean | You send |
|---|---|
| 45.00 SEK | `{"value": 4500, "currency": "SEK"}` |
| 129.90 NOK | `{"value": 12990, "currency": "NOK"}` |
| 9.95 EUR | `{"value": 995, "currency": "EUR"}` |

Always send whole numbers in minor units. A decimal such as `45.5` is rejected, and `45` means 0.45 kr, not 45 kr.

## Showing amounts

Prices that LoyX returns carry two extra fields, so you can format them without hard-coding rules:

```json
{ "value": 4500, "currency": "SEK", "minor_units": 100, "locale": "sv-SE" }
```

- `minor_units` is the divisor: `4500 / 100 = 45.00`.
- `locale` is the RFC 5646 locale to format with. `sv-SE` gives `45,00 kr`.

## Totals are computed by LoyX

On a sale you send line items with a unit price and a quantity. LoyX computes the line totals and the basket total itself, and ignores totals you send. A rounding difference in your system cannot change what the member earns.

If your system only knows what the customer paid, not the lines, send that amount as `totals.paid_minor` instead of `items`. See [Record a sale](/guides/record-sale/).

## Currencies

A brand's program has one currency. Send sales in that currency. The [API reference](/api/) lists the accepted codes.
