Skip to navigation

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

CurrencyCredit currency
IsMoney, by ISO code, such as usdA unit you define, such as adatum_credits
Priced in itEvery kind of price, rate card, commit and feeUsage prices and rate cards only
What usage doesAdds a charge to the next invoiceSpends the customer’s credit balance
Past the balanceOverage, billed in money at the credit currency’s conversion

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

AmountFormatExample
A price or rate in a currencyA decimal string in minor units, up to 15 decimal places"50" in usd is 50¢; "0.375" is 0.375¢
A price or rate in a credit currencyA decimal string in that unit, up to 15 decimal places"0.25" is a quarter of a credit
A credit balance or grantA decimal string in the credit currency, up to 15 decimal places"20000" credits
A commit, or a Money amount such as an amendment preview’s moneyEffectsAn integer in minor units12000000 is $120,000.00

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:

CreditsPrepaid commitInvoiced minimum
Your customer paysFor credits upfront, from a price that grants themamount upfront, invoiced when the commit startsFor usage as normal
Held inA credit currencyMoney, on one orderMoney, on one order
Usage that uses itUsage priced in the credit currency, across all the customer’s orders unless a grant is scopedUsage priced in money on the order, within the commit’s scopeSpend on the order, within the commit’s scope
When it runs outOverage at the credit currency’s conversion, or stop at zero with a credit holdFurther usage at the normal rate, or blocked with overage: "block"
If it isn’t usedCredits expire or roll over, as the grant saysArchiving the commit forfeits what’s leftA true-up line for the shortfall
SuitsSelf-serve products, and rates per kind of work from one balanceEnterprise deals paid upfront in moneyEnterprise deals billed as used, with a floor

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:

StepValue
Exact charge1,234,567 × 375 ÷ 1,000,000 = 462.962625¢
Rounded half-up, once463¢
Invoice line$4.63

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:

StepValue
Spent from the balance600 credits, leaving 0
Overage1,200 − 600 = 600 credits
Overage line600 × 75¢ = 45,000¢ = $450.00