Skip to main content
The Razorpay plugin extends your existing Better Auth schema with Razorpay customer ids and, when subscriptions are enabled, a dedicated subscription table. This page describes every field, the subscription status lifecycle, how to run migrations, and how to rename or remap fields using the schema option.

User fields

Organization fields

When organization: { enabled: true } is set, the organization table also receives:

Subscription table

The subscription table is created only when subscription.enabled is true.

Subscription statuses

Migrations

After installing the plugin and configuring your schema, run the Better Auth CLI to generate and apply migrations.
The exact migration output depends on your database adapter (Prisma, Drizzle, or others). Always review the generated migration before applying it in production.

Customizing the schema

You can rename the subscription table or remap individual fields using the schema plugin option. This follows Better Auth’s plugin schema customization convention.
auth.ts
In the example above:
  • modelName renames the table from subscription to billing_subscription.
  • Each key inside fields maps the internal field name to your preferred column name.
If you only need to rename a few fields, include only those keys in fields. Unmapped fields keep their default names.