Developers

Recipes

Task-based walkthroughs for the billing API: trials, usage-based billing, usage events, AI tokens, prepaid credits, spend limits and automatic top-up, plan changes, coupons, one-time purchases, dunning, India GST and mandates.

Each recipe is one job, end to end: the calls in TypeScript and curl, the real response, what to check, and the errors you are likely to meet. The runnable examples on these pages are checked against the API by an automated test in our repository.

Subscriptions

  • Trials — free trials with and without a card, and what happens when one ends.
  • Usage-based billing — meter consumption and bill it in arrears.
  • Meter usage events — send events keyed by your own ids, count them with meters, bill a rate card.
  • Bill AI tokens — a rate per model and token type, or the model price list with a markup on the list price or on your cost, and your margin.
  • Prepaid AI credits — credit units, credit packs and plan credits, an access check and holds before each call.
  • Spend limits and automatic top-up — spend limits per customer or user, alerts, credit runway, automatic top-up, early usage invoices and a usage widget.
  • Plan changes — upgrades, downgrades and proration.
  • Coupons — reusable coupons, code sets and one-off discounts.

Payments

India

Moving in

Copyright © 2026