Features
- Automatic customer creation on signup
- Customer Portal for self-service billing management
- Subscription management (get, cancel)
- Feature access control (boolean, metered, seats)
- Usage tracking for metered billing
- Seat management for per-user pricing
- Optional webhook handling with signature verification
Installation
- pnpm
- npm
- yarn
- bun
Preparation
Get your API key from the Commet dashboard under Settings → API Keys. Use a key from a sandbox organization while you’re integrating; switch to a live-org key when you go to production..env
Server Configuration
auth.ts
Client Configuration
auth-client.ts
Configuration Options
When
createCustomerOnSignUp is enabled, a Commet customer is automatically created using the user’s ID as the customerId. No database mapping required.Portal Plugin
Redirects users to the Commet customer portal for self-service billing management.Server
Client
Subscriptions Plugin
Manage customer subscriptions.Server
Client
Features Plugin
Check feature access for the authenticated user.Server
Client
Usage Plugin
Track usage events for metered billing.Server
Client
The authenticated user is automatically associated with the event.
Seats Plugin
Manage seat-based licenses.Server
Client
Webhooks Plugin
Handle Commet webhooks. This is optional since you can always query state directly.Server
/api/auth/commet/webhooks
Full Example
1
Server Setup
auth.ts
2
Client Setup
auth-client.ts
3
Usage in Components
dashboard.tsx