Skip to main content
This guide shows you how to refund payments using the better-auth-razorpay plugin. You can issue full or partial refunds, choose the refund speed, add notes, and handle refund webhooks to keep your system in sync.
1

Issue a refund

Call the refund endpoint with the payment ID. Omit amount for a full refund, or pass a smaller amount for a partial refund.
server.ts
From the client:
2

Fetch and list refunds

Use the refund endpoints to retrieve a single refund or list refunds with pagination.
On the server:
3

Edit a refund

You can update the notes on an existing refund.
Server alternative:
4

Handle refund webhooks

Configure the plugin callbacks to react when Razorpay notifies you about refund state changes.
auth.ts

React hooks for refunds

If you use TanStack Query in your React app, the plugin provides query and mutation hooks for refunds.

List refunds

refunds-list.tsx

Edit a refund

edit-refund.tsx

Error handling