Billing API
Stripe-powered billing โ checkout, subscriptions, invoices, and usage tracking. All endpoints except webhooks require JWT authentication.
Endpoints (9)
GET
/api/v1/billing/status ๐
Get billing status โ current plan, subscription state, payment method.
curl https://api.privabase.com/api/v1/billing/status \
-H "Authorization: Bearer YOUR_TOKEN"
GET
/api/v1/billing/customers/me ๐
Get the Stripe customer record for the current user.
POST
/api/v1/billing/checkout ๐
Create a Stripe Checkout session for subscribing to a plan.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
priceId | string | Yes | Stripe price ID |
successUrl | string | No | Redirect URL after success |
cancelUrl | string | No | Redirect URL after cancel |
Response
{ "success": true, "data": { "url": "https://checkout.stripe.com/..." } }
POST
/api/v1/billing/portal ๐
Create a Stripe Customer Portal session for managing subscriptions and payment methods.
Response
{ "success": true, "data": { "url": "https://billing.stripe.com/..." } }
GET
/api/v1/billing/subscription ๐
Get current subscription details โ plan, status, renewal date.
GET
/api/v1/billing/usage ๐
Get API usage for the current billing period.
curl https://api.privabase.com/api/v1/billing/usage \
-H "Authorization: Bearer YOUR_TOKEN"
Response
{
"success": true,
"data": {
"period": { "start": "2026-03-01", "end": "2026-03-31" },
"checksRun": 142,
"assessments": 38,
"policiesGenerated": 12,
"limit": 1000
}
}
GET
/api/v1/billing/invoices ๐
List past invoices.
POST
/api/v1/billing/webhook
Stripe webhook endpoint. See the Webhook Reference for event types.
โน๏ธ Internal Endpoint
This endpoint receives Stripe webhook events. You don't call it directly โ Stripe sends events here.
POST
/api/v1/billing/track-usage
Internal usage tracking endpoint. Records API usage for metered billing.