# Better Auth Plugin[](#better-auth-plugin)

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


The Chargebee Better Auth plugin provides deep integration between [Better Auth](https://www.better-auth.com) and Chargebee, including automatic customer creation, subscription lifecycle management, and team/organization billing support.

## Prerequisites[](#prerequisites)

-   Better Auth 1.4 or later
-   [Chargebee Node.js SDK](/docs/sdks/nodejs) v3.21.0 or later

## Installation[](#installation)

Install both the plugin and the Chargebee SDK:

## Features[](#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[](#setup)

### 1\. Configure the Server Plugin[](#1-configure-the-server-plugin)

### 2\. Configure the Client Plugin[](#2-configure-the-client-plugin)

### 3\. Run Database Migration[](#3-run-database-migration)

The plugin adds billing-related tables to your database:

### 4\. Configure Webhooks[](#4-configure-webhooks)

In the Chargebee dashboard, create a webhook pointing to:

### 5\. Organization Billing (Optional)[](#5-organization-billing-optional)

## Links[](#links)

-   [GitHub Repository](https://github.com/chargebee/js-framework-adapters)
-   [Better Auth Documentation](https://www.better-auth.com)
-   [Node.js SDK](/docs/sdks/nodejs)
-   [API Reference](/docs/api/getting-started)