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

FieldTypeRequiredDescription
priceIdstringYesStripe price ID
successUrlstringNoRedirect URL after success
cancelUrlstringNoRedirect 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.