1. Install the plugin
^1.5.6 is required for native endpoint type inference. The Creem TypeScript SDK is
included as a dependency of the plugin.
2. Configure the server plugin
Add your test API key and a webhook signing secret to the server environment:.env
lib/auth.ts
webhookSecret is present.
3. Generate the database schema
The plugin addscreemCustomerId and hadTrial to the Better Auth user model and creates a
creem_subscription model. With Better Auth’s built-in Kysely adapter, apply the schema directly:
4. Configure the client plugin
lib/auth-client.ts
session.user.creemCustomerId through Better Auth.
If client and server are separate applications, install @creem_io/better-auth in both.
5. Create a checkout
The signed-in user’s email is used when no customer is supplied. Their Better Auth user ID is added to checkout metadata asreferenceId. Navigation is manual by default; pass redirect: true
to let Better Auth navigate automatically.
app/pricing/subscribe-button.tsx
6. Register the webhook
In the Creem dashboard, point a test-mode webhook at:/api/auth is Better Auth’s default base path. Use your configured base path if you changed it.
For local development, expose the application over HTTPS with a tunnel and register that URL.
Once Creem delivers subscription events, the plugin updates the local subscription record. You can
also add access callbacks for application-specific provisioning.
Continue
Configuration
Review every plugin option and persistence behavior.
Client API
Add the portal, cancellation, access checks, and transaction history.