Skip to content

Customer Portal and Admin Links

Let customers and internal admins manage billing in BillStack.

BillStack provides these management surfaces:

Customer portal session (v2)

Create a portal session from your server. The v2 route opens the provider's own hosted portal for the customer (Stripe only; see the note below):

curl -X POST "https://billing.w3dev.app/api/billstack/v2/teams/{teamId}/projects/{projectId}/portal" \
  -H "Authorization: Bearer <private-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ "customerExternalId": "user_123", "returnUrl": "https://your-app.example/account/billing" }'

Redirect the customer to data.portalUrl. The route needs the portal:CreateSession action, and an unpinned customer with accounts at several providers needs provider or regionId. Details are in Multi-provider v2.

Legacy (v1) portal call

This is the legacy route. Use it only when your integration already calls /api/billstack/teams/..., or when you need BillStack's own hosted portal for a Razorpay customer. See Legacy customer portal.

Create a short-lived customer portal URL from your server:

curl -X POST "https://billing.w3dev.app/api/billstack/teams/{teamId}/projects/{projectId}/portal/by-external-id" \
  -H "Authorization: Bearer <private-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ "externalId": "user_123" }'

Response:

{
  "sessionId": "ps_...",
  "token": "...",
  "portalUrl": "https://billing.w3dev.app/portal/...",
  "expiresAt": "2026-06-12T12:00:00.000Z"
}

Redirect the user to portalUrl. The response also carries url, a deprecated alias of portalUrl for older SDK versions; read portalUrl.

Two session families exist and they open different pages. The legacy routes (.../portal and .../portal/by-external-id) open BillStack's own hosted page at /portal/{token}, which supports Stripe and Razorpay customers: see Customer portal for the capability matrix. The v2 route POST /api/billstack/v2/.../portal (see Multi-provider v2) asks the provider for its own hosted portal (the pinned region's account when the customer has several; an unpinned customer with accounts at more than one provider needs provider or regionId, otherwise 409 CUSTOMER_PROVIDER_ACCOUNT_AMBIGUOUS) and is Stripe only; Razorpay and RevenueCat answer PROVIDER_ACTION_UNSUPPORTED there.

Customer not found

The portal endpoint returns 404 if no BillStack customer exists for that externalId.

Handle this by showing an upgrade CTA or by creating checkout first. Do not create empty provider customers in your app only to open the portal.

Your product admin panel should link to the BillStack project dashboard instead of rebuilding billing administration. The current dashboard lives under /v2/{team}/{project}; the legacy dashboard at /dashboard/{team}/{project} still works for teams that have not moved.

These are compatibility variables for the integrating app, not BillStack deployment variables. Use either an explicit URL:

BILLING_PORTAL_DASHBOARD_URL=https://billing.w3dev.app/v2/team-slug/project-slug

or build it from slugs:

BILLING_PORTAL_WORKSPACE_SLUG=team-slug
BILLING_PORTAL_PROJECT_SLUG=project-slug

BILLING_PORTAL_WORKSPACE_SLUG is retained for compatibility with existing product integrations. Despite its legacy name, its value is the BillStack team slug.

Common admin links:

  • Project home: /v2/{team}/{project}.
  • Integrations: /v2/{team}/{project}/integrations, provider configuration.
  • Referrals: /v2/{team}/{project}/referrals.
  • Catalog: /v2/{team}/{project}/catalog, products and prices.
  • Subscriptions, customers and webhook deliveries: /v2/{team}/{project}/subscriptions, /customers and /webhooks.
  • Analytics: /v2/{team}/{project}/analytics, revenue per currency, churn, customer growth and event health.
  • Invoices: /v2/{team}/{project}/invoices, with the source of the rows named on the page. An open Stripe invoice can be voided or marked uncollectible from its row after a confirmation, and a team admin can start or watch the team's Stripe sync from the page.
  • Payments: /v2/{team}/{project}/payments, the payments attributed to the project by the same customer-link rule as the invoices.
  • Provider events and diagnostics: /v2/{team}/{project}/provider-events (inbound events from your payment provider) and /diagnostics (health of bindings, checkouts and outbound endpoints, with identifiers masked).
  • Query: /v2/{team}/{project}/query, read-only BillingQL over the project's customers, subscriptions, products and prices.

Team-wide pages live under /v2/{team}/~/: the home with revenue, subscriber and churn charts, the Billing tabs (/~/billing/overview, /subscribers, /trials, /churn, /collections), the money pages (/~/payments, /customers, /invoices, /subscriptions, /disputes, /payouts, /balance), /~/products, /~/webhooks (inbound Stripe deliveries), /~/query and /~/settings/stripe (sync status and backfill). They show your Stripe account's data, and canonical BillStack records for a resource once those are enabled for it. Every page of the legacy dashboard has a counterpart under /v2. Voiding an invoice or marking it uncollectible is available on the v2 invoice lists and detail pages for Stripe invoices. The Stripe webhook endpoint setup lives on the Integrations page, and removing a Stripe key (with its synced copy) is a separate, confirmed danger zone on the Stripe sync page.

Keep admin actions in BillStack so your app does not need provider secrets or refund logic.

Change or cancel from your own UI

When you want a plan switch or a cancel button inside your app instead of sending the customer to a portal, call the subscription management routes from your server: read a subscription, preview and apply a switch to another price variant, cancel at the period end or immediately, and resume a scheduled cancel. BillStack uses the subscription's own provider account, so your app still holds no provider secrets. Stripe supports all of it; Razorpay supports cancelling at the period end.