Commet
  • Pricing
Log InTry out
Introduction

Quickstart

Learn

Manage CustomersCustomer Portal

Resources

SDK ReferenceError HandlingTestingCLI

Plugins

Better Auth
DocumentationKnowledge BaseBuild with AIAPI ReferenceWebhooks

Customer Portal

Self-service portal for customers to manage their subscriptions.

Self-service page where customers manage their subscription, view usage, change plans, and purchase credits. Automatically created with every subscription.

What customers can do

  • View current subscription and billing cycle
  • See usage across all features
  • Upgrade or downgrade plans (requires a Plan Group)
  • Purchase Credit Packs, balance top-ups, and Add-ons
  • Update payment method and billing details
  • View invoice history
  • Cancel subscription

Purchases are available on active, trialing, and free plan subscriptions. Free plan customers are prompted to add a payment method on their first purchase.

Generate a portal URL

Portal URLs are single-use and expire after 2 hours of inactivity. Generate a fresh URL on each request.

const portal = await commet.portal.getUrl({ customerId: 'user_123' })

redirect(portal.data.portalUrl)
portal = commet.portal.get_url(customer_id='user_123')

redirect(portal.data['portal_url'])
portal, err := client.Portal.GetURL(ctx, &commet.GetPortalURLParams{
    CustomerID: "user_123",
})

// redirect(portal.Data.PortalURL)
ApiResponse<PortalSession> portal = commet.portal().getUrl("user_123", null, null);

// redirect(portal.getData().getPortalUrl())
$portal = $commet->portal->getUrl(customerId: 'user_123');

redirect($portal->data['portalUrl']);
curl -X POST https://commet.co/api/portal/request-access \
  -H "x-api-key: $COMMET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123"}'

You can identify customers by customerId (Commet ID or your external ID) or email.

Next.js helper

@commet/next (Node.js only) provides a one-line route handler that generates portal URLs and redirects automatically.

app/api/commet/portal/route.ts
import { CustomerPortal } from '@commet/next'

export const GET = CustomerPortal({
  apiKey: process.env.COMMET_API_KEY!,
  getCustomerId: async (req) => {
    return 'user_123'
  },
})
<a href="/api/commet/portal">Manage Billing</a>

Related

  • Manage Subscriptions
  • Plan Groups
  • Credit Packs

How is this guide?

Manage Customers

Create and manage customers using the Commet SDK and dashboard.

Manage Plans

Create and manage pricing plans in Commet that automatically generate subscriptions.

On this page

What customers can do
Generate a portal URL
Next.js helper
Related