Skip to main content
Better Auth Razorpay is a Better Auth plugin that integrates Razorpay into your application. It gives you one-time payments, refunds, Route transfers, subscriptions with trials and seat-based billing, invoices, customers, plans, items, add-ons, webhooks, and optional TanStack Query React hooks. All of this is managed through your existing Better Auth setup so you do not need a separate payments backend.

What you get

The plugin is split into three parts: a server plugin, a client plugin, and an optional React hooks package. The server plugin registers endpoints under your Better Auth handler. The client plugin exposes typed methods on your auth client. The React hooks wrap those methods with TanStack Query for caching and loading states.

One-time payments

Create orders, capture payments, and verify signatures.

Subscriptions

Manage recurring billing, upgrades, pauses, and cancellations.

Organizations

Bill teams and sync seat counts with member changes.

Webhooks

Handle Razorpay events with built-in signature verification.

React hooks

Query and mutate payments and subscriptions from React.

API reference

Browse every endpoint and parameter.

Requirements

  • Better Auth ^1.7.0
  • TypeScript ^5.6.3
  • A Razorpay account with API keys
  • Optional: @tanstack/react-query ^5.104.3 and react ^19.3.0 if you use the React hooks

Quick teaser

Add the server plugin to your auth config:
auth.ts
Add the client plugin:
client.ts
Then create an order and open Razorpay Checkout:
See the Quickstart for a complete end-to-end example, or jump to Installation to set up your project.