Better Auth Plugin
The Chargebee Better Auth plugin provides deep integration between Better Auth and Chargebee, including automatic customer creation, subscription lifecycle management, and team/organization billing support.
Prerequisites
- Better Auth 1.4 or later
- Chargebee Node.js SDK v3.21.0 or later
Installation
Install both the plugin and the Chargebee SDK:
Features
- Auto Customer Creation — Automatically create Chargebee customers when users sign up
- Subscription Lifecycle — Create, update, and cancel subscriptions via Chargebee Hosted Pages
- Trial Management — Trial periods with configurable abuse prevention
- Team/Org Billing — Organization-level billing support
- Webhook Sync — Keep auth and billing state synchronized via webhooks with Basic Auth
- DB Schema — Auto-managed database tables for subscriptions and items
Setup
1. Configure the Server Plugin
2. Configure the Client Plugin
3. Run Database Migration
The plugin adds billing-related tables to your database:
4. Configure Webhooks
In the Chargebee dashboard, create a webhook pointing to: