# Prices and billing

The balance is in US dollars. A buyer pays for the bytes sent and received through the proxy, at the list price of the country the traffic left from. One gigabyte is 1,000,000,000 bytes.

Read the current list with `GET /app/api/prices`. It needs no account. Countries are grouped in tiers, and each tier has one price per gigabyte in `usdMicrosPerGb`, where one micro-USD is a millionth of a dollar. A country that is in no tier is charged at `defaultTier`. The owner sets the prices, and a price change applies to traffic carried after it. Traffic already carried keeps the price it was charged at.

## Exact amounts

Every amount is an integer. An amount on the wire is `{"usdMicros": "...", "n": "..."}`. `n` is the exact figure, in units of which `nPerUsdMicro` (10,000,000,000,000) make one micro-USD. `usdMicros` is `n` divided by that number, toward zero, for display. Add amounts with `n` and a big-integer type. A request of `b` bytes at a price of `p` micro-USD per gigabyte costs `b × p × 10,000` units.

A top-up is credited as its amount in micro-USD times `nPerUsdMicro`. Free credit from the operator is spent before paid credit. A balance below zero is owed: traffic that was already in flight when the balance ran out is charged in full.

- `GET /app/api/billing` returns the balance, its state and what this month was charged.
- `GET /app/api/billing/statement?month=YYYY-MM` lists each day and country with its tier, price, requests, bytes and charge.
- `GET /app/api/billing/payments` lists credits and open quotes.
- `POST /app/api/billing/quotes` then `POST /app/api/billing/topups` add funds. A quote lasts 30 minutes, and `providers` in the billing answer says which providers are configured, the only ones that take a quote, and the least and the most each takes.

A device owner's share and hold period are in the [guide for device owners](/guides/device-owners.md).
