/api/auth/*. The exact prefix depends on how you mount the Better Auth handler in your application. If you mount at /api/auth, a Razorpay endpoint such as POST /razorpay/create-order is available at POST /api/auth/razorpay/create-order.
Authentication
By default, every endpoint requires a valid Better Auth session cookie. The plugin setsrequireSession: true unless you override it in the plugin options. When requireSession is false, the one-time payment and transfer endpoints do not enforce a session.
The standard Better Auth session cookie. Sent automatically by the browser or included as a header in server-to-server calls.
Calling conventions
Client
Use the Better Auth client with the Razorpay client plugin. Endpoint paths are converted to camelCase methods onauthClient.razorpay and authClient.subscription.
POSTcalls pass the body object directly.GETcalls pass{ query: { ... } }.- Responses follow the Better Auth convention:
{ data, error }.
Server
Call endpoints directly from server code usingauth.api.<name>:
Pagination
List endpoints support a common pagination shape:Error format
Errors are returned as Better Auth API errors. The client receives an object withcode and message.
BAD_REQUEST, NOT_FOUND, INTERNAL_SERVER_ERROR, FORBIDDEN, UNAUTHORIZED. See Error codes for the full list.
Endpoint groups
Orders
Create, retrieve, edit, and list Razorpay orders. Verify payments against an order.
Payments
Retrieve, list, edit, and capture Razorpay payments.
Refunds
Refund payments and manage refund records.
Transfers
Create and manage Razorpay Route transfers between linked accounts.
Subscriptions
Upgrade, cancel, pause, resume, and restore plugin-managed subscriptions.
Razorpay subscriptions
Direct Razorpay subscription APIs: links, add-ons, offers, invoices, and pending updates.
Plans
Create and retrieve Razorpay billing plans.
Invoices
Create, issue, edit, cancel, notify, and list Razorpay invoices.
Customers
Create, edit, and list Razorpay customers. Manage bank accounts and tokens.
Items
Create, edit, delete, and list Razorpay catalog items.
Add-ons
Retrieve, list, and delete Razorpay subscription add-ons.
Webhook
Receive and verify Razorpay webhook events.
Subscription-only endpoints
Several endpoints are registered only whensubscription.enabled: true in the plugin options:
- Subscription lifecycle:
upgrade,cancel,pause,resume,update,restore - Subscription queries:
list,get - Razorpay subscription list:
fetchAllSubscriptions
404.