Skip to main content
The better-auth-razorpay plugin supports seat-based billing by using the quantity field on subscriptions. You can set a default quantity in the plan config, update it manually through the API, or let the plugin sync it automatically when organization members are added or removed.

Plan quantity

Set quantity on a plan to define the default number of seats included in the subscription. The value is stored on the local subscription row and passed to Razorpay when the subscription is created.
auth.ts
quantity: false disables quantity tracking for that plan. quantity: 1 or higher enables seat-based billing.

Updating quantity manually

Call subscription.update to change the seat count at any time. You can apply the change immediately or schedule it for the end of the current billing cycle.
number
required
New seat count. Must be a positive integer.
string
"now" applies immediately. "cycle_end" applies after the current period ends.
Razorpay prorates seat changes based on your plan settings. The plugin returns the updated local subscription and the Razorpay subscription object.

Automatic seat sync for organizations

When you enable the Better Auth organization plugin and set organization: { enabled: true } in the Razorpay plugin, seat counts sync automatically:
  • Member added: the plugin increments the subscription quantity by 1.
  • Member removed: the plugin decrements the subscription quantity by 1.
  • Invitation accepted: the plugin increments the subscription quantity by 1 when the invitee joins.
This only applies to subscriptions on plans that have quantity configured. The plugin uses the active organization’s subscription and updates the quantity through Razorpay’s subscription update API.
auth.ts
Automatic seat sync requires the organization plugin and organization.enabled: true. Deleting an organization with an active subscription is blocked with ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION.

React example: seat management UI

Build a team settings page where admins can view and adjust seat counts.
app/team/billing/page.tsx

Common errors