Overview
Usage-based (metered) billing lets you charge customers based on actual consumption — API calls, seats, storage, or any unit you define.1. Create a metered plan
Setbilling_type to METERED and define price_per_unit:
2. Report usage
As your customers consume units, report them via the API:Usage records are append-only. The same
idempotency_key will not be recorded twice.3. Check current usage
See what’s unbilled for the current period:4. Billing
At the end of each billing period, the ARQ worker automatically:- Sums all unbilled usage records
- Creates an invoice for
total_quantity × price_per_unit - Attempts to charge the customer
- Marks the usage records as billed
Idempotency
Each usage report requires a uniqueidempotency_key. If you send the same key twice, the second request returns created: false without duplicating the record.
Best practice: use a deterministic key like {subscription_id}_{date}_{event_type}.