Billing API Reference
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/billing/subscription | Get current subscription |
| POST | /api/billing/checkout | Create Stripe checkout session |
| POST | /api/billing/portal | Create Stripe billing portal |
| GET | /api/billing/usage | Get usage metrics |
| POST | /api/billing/token-packs | Purchase token pack |
Webhooks
Stripe events are processed automatically. Supported events:
checkout.session.completed— Subscription createdinvoice.paid— Payment receivedcustomer.subscription.updated— Plan changedcustomer.subscription.deleted— Subscription cancelled