Billing API
GET /billing/plans
List available subscription plans. No auth required.
Response 200
[
{
"id": "plan_01j...",
"name": "Starter",
"price": 29.00,
"trialDays": 14,
"msgPerDay": 1000,
"msgPerMonth": 20000,
"maxChannels": 3,
"allowedProviders": ["whatsapp", "sms"],
"isActive": true,
"sortOrder": 1
}
]
GET /billing/subscription
Get the current subscription. Bearer JWT required.
Response 200
{
"id": "sub_01j...",
"planId": "plan_01j...",
"status": "active",
"currentPeriodStart": "ISO8601",
"currentPeriodEnd": "ISO8601",
"trialEnd": "ISO8601 | null",
"canceledAt": "ISO8601 | null"
}
Subscription statuses: trialing, active, past_due, canceled, unpaid
POST /billing/checkout
Create a Stripe checkout session to subscribe to a plan. Bearer JWT required.
Request
{ "planId": "UUID" }
Response 201 — Stripe checkout session with url to redirect the user.
DELETE /billing/subscription
Cancel the current subscription. Bearer JWT required.
Request
{
"reason": "Too expensive",
"comment": "Optional free-text comment"
}
Response 200 — cancellation confirmation.
POST /billing/portal
Create a Stripe billing portal session for the user to manage their payment method. Bearer JWT required.
Response 201 — portal session with url.