Billing API
API endpoints for subscription management, checkout, and feature gating.
Overview
The Billing API manages organization subscriptions, Stripe checkout sessions, and feature access control. ProBeya uses a tiered subscription model with feature gates to control access to premium capabilities.
Get Subscription
Retrieve the current subscription details for the organization.
GET /api/trpc/billing.getSubscription
Response:
{
"result": {
"data": {
"json": {
"subscription": {
"id": "sub_01HXK5QJBN3YZXM8KJP2RSNV4C",
"plan": "business",
"status": "active",
"interval": "monthly",
"currentPeriodStart": "2026-03-01T00:00:00.000Z",
"currentPeriodEnd": "2026-03-31T23:59:59.000Z",
"cancelAtPeriodEnd": false,
"seats": {
"included": 25,
"used": 18,
"available": 7
},
"features": {
"maxBoards": 50,
"maxItemsPerBoard": 10000,
"automations": true,
"kpis": true,
"templates": true,
"csvImport": true,
"apiAccess": true,
"sso": false,
"auditLog": true,
"customBranding": true
},
"stripeCustomerId": "cus_Abc123...",
"stripeSubscriptionId": "sub_Xyz789..."
}
}
}
}
}
Plan Tiers
| Plan | Seats | Boards | KPIs | Automations | API Access |
|---|---|---|---|---|---|
free | 3 | 3 | No | No | No |
starter | 10 | 10 | Yes | 5 per board | No |
business | 25 | 50 | Yes | Unlimited | Yes |
enterprise | Unlimited | Unlimited | Yes | Unlimited | Yes |
Create Checkout Session
Generate a Stripe Checkout session URL for plan upgrades or new subscriptions.
POST /api/trpc/billing.createCheckoutSession
Request:
{
"json": {
"plan": "business",
"interval": "annual",
"seats": 25,
"successUrl": "https://acme.probeya.com/settings/billing?success=true",
"cancelUrl": "https://acme.probeya.com/settings/billing"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | Target plan: starter, business, enterprise |
interval | string | Yes | monthly or annual |
seats | number | No | Number of seats (uses plan default if omitted) |
successUrl | string | Yes | Redirect URL after successful payment |
cancelUrl | string | Yes | Redirect URL if checkout is cancelled |
Response:
{
"result": {
"data": {
"json": {
"checkoutUrl": "https://checkout.stripe.com/c/pay/cs_live_...",
"sessionId": "cs_live_01HXK5..."
}
}
}
}
The checkout URL expires after 24 hours. Redirect the user immediately after generating it. After payment, Stripe webhooks update the subscription status automatically.
Create Portal Session
Generate a Stripe Customer Portal URL for managing payment methods, invoices, and cancellation.
POST /api/trpc/billing.createPortalSession
Request:
{
"json": {
"returnUrl": "https://acme.probeya.com/settings/billing"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
returnUrl | string | Yes | URL to redirect to after leaving the portal |
Response:
{
"result": {
"data": {
"json": {
"portalUrl": "https://billing.stripe.com/p/session/..."
}
}
}
}
Check Feature Gate
Check whether the current organization has access to a specific feature. Use this to conditionally render UI elements or guard API calls.
GET /api/trpc/billing.checkFeatureGate?input={"json":{"feature":"kpis"}}
| Parameter | Type | Required | Description |
|---|---|---|---|
feature | string | Yes | Feature key to check |
Response:
{
"result": {
"data": {
"json": {
"feature": "kpis",
"allowed": true,
"plan": "business",
"limit": null,
"usage": null
}
}
}
}
For features with usage limits:
{
"result": {
"data": {
"json": {
"feature": "automations",
"allowed": true,
"plan": "starter",
"limit": 5,
"usage": 3
}
}
}
}
Feature Keys
| Key | Description |
|---|---|
kpis | KPI definitions and tracking |
automations | Automation rules |
templates | Custom template creation |
csv_import | CSV data import |
api_access | External API access |
sso | SAML/OIDC single sign-on |
audit_log | Detailed audit trail |
custom_branding | Custom logo, colors, subdomain |
webhooks | Outbound webhook integrations |
advanced_permissions | Fine-grained role-based access |
Use checkFeatureGate on the client side to show upgrade prompts for locked features. The response includes the current plan so you can display targeted upgrade messaging.
Was this page helpful?