Skip to main content
The plugin throws errors via the Better Auth API error system. On the client, each error has a code and message you can inspect to handle failures gracefully.

Importing error codes

The server entry and client entry both re-export RAZORPAY_ERROR_CODES.

Checking error codes

Compare the error code directly in your client or server code.

General errors

Payment and order errors

Refund errors

Subscription errors

Plan errors

Invoice errors

Customer errors

Add-on and item errors

Transfer errors

Webhook errors

Handling errors in React

When using TanStack Query hooks, errors surface through the mutation or query error state.