Subscription Plans
List Plans
GET /api/billing/plans
Output: Array<{
id: string
name: string
description: string | null
storeId: string | null
variants: Array<{
id: string
price: number
currency: string
interval: string
interval_count: number
}>
}>
Subscriptions
Create Checkout Link
POST /api/billing/checkout
Input:
{
planId: string
variantId: string
teamId: string
redirectUrl?: string
}
Output: string // Checkout URL
Create Customer Portal Link
POST /api/billing/portal
Input:
{
subscriptionId: string
redirectUrl?: string
}
Output: string // Customer Portal URL
Cancel Subscription
POST /api/billing/cancel
Input:
{
id: string
}
Output: void
Resume Subscription
POST /api/billing/resume
Input:
{
id: string
}
Output: {
status: "ACTIVE" | "CANCELED" | "PAST_DUE" | "UNPAID" | "INCOMPLETE"
}
Sync Subscription (Admin Only)
POST /api/billing/sync
Input: {
id: string
teamId: string
customerId: string
status: "ACTIVE" | "CANCELED" | "PAST_DUE" | "UNPAID" | "INCOMPLETE"
planId: string
variantId: string
currentPeriodStart: Date
currentPeriodEnd: Date
canceledAt: Date | null
cancelAtPeriodEnd: boolean
}
Output: void
Notes
- All endpoints except
List Plansrequire authentication. - Most endpoints require team owner permissions.
- The billing system supports multiple providers (Stripe, Chargebee, LemonSqueezy) with a unified API interface.
- Subscription status changes are handled asynchronously through webhooks.
- All monetary values are in the smallest currency unit (e.g., cents for USD).