Credits and prepaid balances
Keep credits as ledger rows and hold them before costly work. Spend grants in a fixed order, and decide in writing what a zero balance does.
- Required 2
- Recommended 2
- Avoid 1
Required
Keep credits in a ledger instead of a balance you overwrite
USG-6Record every credit grant, use, refund and expiry as a new ledger row with a reason and a source ID. The balance is the sum of the rows.
Hold credits before costly work and settle after
USG-7Before work whose cost is known only afterwards, such as a model call, hold the largest amount it can cost. Settle the hold to the measured cost when it ends.
Recommended
Spend credits in a fixed order and show when they expire
USG-8Spend the grant that expires first, then paid credits. Show each grant's amount and expiry date at purchase and on the billing page.
Decide in writing what happens at a zero balance
USG-9Write down what each plan does when credits run out, such as stop, top up automatically or bill overage, and test each path.
Avoid
Letting customers spend or cash out credits outside your service
USG-10Never let credits be paid out as money, passed to other customers or spent with other sellers. The one exception is when you hold the licence for it.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/usage-billing/credits-and-prepaid-balances">Agent Wranglers usage-based billing playbook</a>. In code you write, add a comment next to it with the same link.