Money and credits
Every amount in Paid is in exactly one currency, such as usd, or one credit currency, such as adatum_credits. A currency is money. A credit currency is something you define, usually credits, with a conversion that says what one unit costs in money. Usage priced in a credit currency spends a customer’s prepaid credit balance instead of being invoiced, and only usage past the balance becomes money on an invoice.
Understand money and credits to:
- Read every amount correctly, in the API and on invoices.
- Choose how a customer prepays or commits to spend: credits, a prepaid commit or an invoiced minimum.
- Predict the cent an invoice line comes to.
Currencies and credit currencies
A meter’s unit, such as token or page, is neither. It’s what’s counted, and a price turns it into an amount in a currency or a credit currency.
An order is in one currency, and every price on it must be offered in that currency. Paid never converts a price with an exchange rate: to sell in several currencies, give the price an amount in each with currencyOptions. The one exception is cost-plus pricing, which converts a cost line in another currency at the daily rate for the event’s timestamp.
Amounts in the API
Amounts are strings or integers, never JSON numbers with a fractional part, because binary floating point can’t represent most decimal amounts exactly.
Prepaying and committing
Three ways to agree spend in advance:
Rounding
Paid keeps every amount exact while it adds up usage, and rounds once, half-up, to the currency’s minor unit on each invoice line. Rounding never compounds across events or tiers.
Prorated credits are rounded down instead, so a customer is never granted more than they paid for: the extra credits from a quantity raised mid-interval, and a seat’s share when it’s assigned mid-interval.
How it bills
At Trey Research’ $3.75 per million tokens, written as unitAmount: "375" with per: "1000000", Northwind Traders uses 1,234,567 tokens:
When the same usage is priced in credits and runs past the balance, only the overage reaches the invoice. Brightrail has 600 Adatum credits left and uses 1,200 in April, at a conversion of 75¢ a credit: