> ## Documentation Index
> Fetch the complete documentation index at: https://better-auth-razorpay.amankushwaha.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments

> Retrieve, list, edit, and capture Razorpay payments through the plugin endpoints.

The payments endpoints let you inspect individual payments, list historical payments, update payment notes, and manually capture authorized payments.

## Get payment

`GET /api/auth/razorpay/payment`

Retrieves a single Razorpay payment by id.

**Server API name:** `getRazorpayPayment`\
**Client method:** `authClient.razorpay.payment({ query: { id } })`

**id** `string` *required*

Razorpay payment id, for example `pay_XXXX`.

> [!NOTE]
>
> Errors: `PAYMENT_FETCH_FAILED`.

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.payment({
  query: { id: "pay_XXXX" },
});
```

```ts server.ts theme={null}
const result = await auth.api.getRazorpayPayment({
  query: { id: "pay_XXXX" },
  headers: await headers(),
});
```

## List payments

`GET /api/auth/razorpay/payment/list`

Lists Razorpay payments with pagination and optional filters.

**Server API name:** `fetchAllPayments`\
**Client method:** `authClient.razorpay.payment.list({ query: { ... } })`

**from** `integer`

Unix timestamp. Return payments created after this time.

**to** `integer`

Unix timestamp. Return payments created before this time.

**count** `integer`

Maximum number of payments to return. Maximum value is `100`.

**skip** `integer`

Number of payments to skip.

**expand** `string`

Comma-separated list of related resources to expand.

**reference\_id** `string`

Filter by reference id.

**transfer** `string`

Filter by transfer details.

> [!NOTE]
>
> Errors: `PAYMENT_LIST_FAILED`.

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.payment.list({
  query: { count: 20, skip: 0 },
});
```

```ts server.ts theme={null}
const result = await auth.api.fetchAllPayments({
  query: { count: 20, skip: 0 },
  headers: await headers(),
});
```

## Edit payment

`POST /api/auth/razorpay/payment/edit`

Updates the notes on an existing Razorpay payment.

**Server API name:** `editPayment`\
**Client method:** `authClient.razorpay.payment.edit(...)`

**paymentId** `string` *required*

Razorpay payment id to update.

**notes** `object`

New notes object. Up to 15 key-value pairs, values 256 characters or fewer.

> [!NOTE]
>
> Errors: `PAYMENT_EDIT_FAILED`.

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.payment.edit({
  paymentId: "pay_XXXX",
  notes: { updated: "true" },
});
```

```ts server.ts theme={null}
const result = await auth.api.editPayment({
  body: {
    paymentId: "pay_XXXX",
    notes: { updated: "true" },
  },
  headers: await headers(),
});
```

## Capture payment

`POST /api/auth/razorpay/payment/capture`

Manually captures an authorized payment. Use this when you create an order with `paymentCapture: false` and want to capture the payment later, for example after verifying stock or shipping details.

**Server API name:** `captureRazorpayPayment`\
**Client method:** `authClient.razorpay.payment.capture(...)`

**paymentId** `string` *required*

Razorpay payment id to capture.

**amount** `integer` *required*

Amount to capture, in subunits. Must not exceed the authorized amount.

**currency** `string` (default: INR)

ISO 4217 currency code. Three characters.

> [!NOTE]
>
> Errors: `PAYMENT_NOT_CAPTURED`.

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.payment.capture({
  paymentId: "pay_XXXX",
  amount: 50000,
  currency: "INR",
});
```

```ts server.ts theme={null}
const result = await auth.api.captureRazorpayPayment({
  body: {
    paymentId: "pay_XXXX",
    amount: 50000,
    currency: "INR",
  },
  headers: await headers(),
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.