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

PlanSeatsBoardsKPIsAutomationsAPI Access
free33NoNoNo
starter1010Yes5 per boardNo
business2550YesUnlimitedYes
enterpriseUnlimitedUnlimitedYesUnlimitedYes

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"
  }
}
FieldTypeRequiredDescription
planstringYesTarget plan: starter, business, enterprise
intervalstringYesmonthly or annual
seatsnumberNoNumber of seats (uses plan default if omitted)
successUrlstringYesRedirect URL after successful payment
cancelUrlstringYesRedirect 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"
  }
}
FieldTypeRequiredDescription
returnUrlstringYesURL 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"}}
ParameterTypeRequiredDescription
featurestringYesFeature 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

KeyDescription
kpisKPI definitions and tracking
automationsAutomation rules
templatesCustom template creation
csv_importCSV data import
api_accessExternal API access
ssoSAML/OIDC single sign-on
audit_logDetailed audit trail
custom_brandingCustom logo, colors, subdomain
webhooksOutbound webhook integrations
advanced_permissionsFine-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.