Features

Customer Portal

Generate secure portal URLs for customers

Self-service portal where customers manage billing, update payment methods, and view invoices.

Get URL

URL is single-use and expires - generate fresh on each request.

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

redirect(portal.data.portalUrl)

Next.js

One-line setup with @commet/next.

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's externalId from your auth
    return 'user_123'
  },
})
<a href="/api/commet/portal">Manage Billing</a>

How is this guide?