> ## 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.

# Plans

> Create, list, and retrieve Razorpay plans through the plugin endpoints.

The plans endpoints let you create billing plans in Razorpay, list existing plans, and fetch a single plan by id. Plans define the billing interval and are linked to items that describe what is being charged.

## Create plan

`POST /api/auth/razorpay/plan/create`

Creates a new Razorpay plan. A plan requires a billing period, interval, and an item with a name and amount.

**Server API name:** `createPlan`\
**Client method:** `authClient.razorpay.plan.create(...)`

**period** `string` *required*

Billing period. One of `daily`, `weekly`, `monthly`, `quarterly`, or `yearly`.

**interval** `integer` *required*

Interval between billing cycles. Must be a positive integer.

**itemName** `string` *required*

Name of the item being billed.

**itemAmount** `integer` *required*

Amount in the smallest currency subunit. For INR, `50000` equals ₹500.

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

ISO 4217 currency code. Three characters.

**itemDescription** `string`

Optional description of the item.

**notes** `object`

Up to 15 key-value pairs. Each value must be 256 characters or fewer.

**id** `string`

Razorpay plan id, for example `plan_XXXX`.

**period** `string`

Billing period.

**interval** `integer`

Billing interval.

**item** `object`

The item object with `id`, `name`, `amount`, `currency`, and `description`.

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

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.plan.create({
  period: "monthly",
  interval: 1,
  itemName: "Pro Plan",
  itemAmount: 50000,
  itemCurrency: "INR",
  itemDescription: "Monthly access to pro features",
  notes: { tier: "pro" },
});
```

```ts server.ts theme={null}
const result = await auth.api.createPlan({
  body: {
    period: "monthly",
    interval: 1,
    itemName: "Pro Plan",
    itemAmount: 50000,
    itemCurrency: "INR",
    itemDescription: "Monthly access to pro features",
    notes: { tier: "pro" },
  },
  headers: await headers(),
});
```

## List plans

`GET /api/auth/razorpay/plan/list`

Lists Razorpay plans with pagination.

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

**from** `integer`

Unix timestamp. Return plans created after this time.

**to** `integer`

Unix timestamp. Return plans created before this time.

**count** `integer`

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

**skip** `integer`

Number of plans to skip.

**items** `array`

Array of plan objects.

**count** `integer`

Total number of plans returned in this response.

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

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

## Get plan

`GET /api/auth/razorpay/plan/get`

Retrieves a single Razorpay plan by id.

**Server API name:** `fetchPlan`\
**Client method:** `authClient.razorpay.plan.get({ query: { planId } })`

**planId** `string` *required*

Razorpay plan id.

**id** `string`

Razorpay plan id.

**period** `string`

Billing period.

**interval** `integer`

Billing interval.

**item** `object`

The item object.

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

```ts client.ts theme={null}
const { data, error } = await authClient.razorpay.plan.get({
  query: { planId: "plan_XXXX" },
});
```

```ts server.ts theme={null}
const result = await auth.api.fetchPlan({
  query: { planId: "plan_XXXX" },
  headers: await headers(),
});
```


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