API Test keys

API Test keys

Create a Plan

POST
/v1/plans

Click to copy

Use this endpoint to create a plan.

Is this page helpful?

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X POST https://api.razorpay.com/v1/plans \
3
-H "Content-Type: application/json" \
4
-d '{
5
"period": "weekly",
6
"interval": 1,
7
"item": {
8
"name": "Test plan - Weekly",
9
"amount": 69900,
10
"currency": "MYR",
11
"description": "Description for the test plan"
12
},
13
"notes": {
14
"notes_key_1": "Tea, Earl Grey, Hot",
15
"notes_key_2": "Tea, Earl Grey… decaf."
16
}
17
}'

Success

Failure

1
{
2
"id":"plan_00000000000001",
3
"entity":"plan",
4
"interval":1,
5
"period":"weekly",
6
"item":{
7
"id":"item_00000000000001",
8
"active":true,
9
"name":"Test plan - Weekly",
10
"description":"Description for the test plan - Weekly",
11
"amount":69900,
12
"unit_amount":69900,
13
"currency":"MYR",
14
"type":"plan",
15
"unit":null,
16
"tax_inclusive":false,
17
"hsn_code":null,
18
"sac_code":null,
19
"tax_rate":null,
20
"tax_id":null,
21
"tax_group_id":null,
22
"created_at":1580219935,
23
"updated_at":1580219935
24
},
25
"notes":{
26
"notes_key_1":"Tea, Earl Grey, Hot",
27
"notes_key_2":"Tea, Earl Grey… decaf."
28
},
29
"created_at":1580219935
30
}
Request Parameters
period

*

string

This, combined with interval, defines the frequency of the plan. Possible values:

  • daily
  • weekly
  • monthly
  • quarterly
  • yearly

Handy Tips

We allow custom frequencies while creating a plan (for example, once in 3 weeks).

  • For domestic cards, all undefined frequencies except weekly, monthly and yearly are considered as-presented while registering the mandate with banks.

interval

*

integer

This, combined with period, defines the frequency of the plan. If the billing cycle is 2 months, the value should be 2.

Handy Tips

For daily plans, the minimum value should be 7.

item
object

Details of the plan.

Show child parameters (4)

notes
object

Notes you can enter of the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Monthly gym membership".

Response Parameters
id
string

The unique identifier linked to a plan. For example, plan_00000000000001. This ID is used when creating a subscription for a customer.

entity
string

The entity being created. Here, it is plan.

interval
integer

Used together with period to define how often the customer should be charged.

period
string

Used together with interval to define how often the customer should be charged. Possible values:

  • daily
  • weekly
  • monthly
  • yearly

item
array

Details of the plan.

Show child parameters (5)

notes
object

Notes you can enter of the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Monthly Gym".

created_at
integer

The Unix timestamp at which the plan was created.

Errors

offer_id is/are not required and should not be sent

Error Status: 400

This error occurs when you are passing offer_id parameter in the request body.

Solution

Create a Plan

POST
/v1/plans

Click to copy

Use this endpoint to create a plan.

Is this page helpful?

Request Parameters
period

*

string

This, combined with interval, defines the frequency of the plan. Possible values:

  • daily
  • weekly
  • monthly
  • quarterly
  • yearly

Handy Tips

We allow custom frequencies while creating a plan (for example, once in 3 weeks).

  • For domestic cards, all undefined frequencies except weekly, monthly and yearly are considered as-presented while registering the mandate with banks.

interval

*

integer

This, combined with period, defines the frequency of the plan. If the billing cycle is 2 months, the value should be 2.

Handy Tips

For daily plans, the minimum value should be 7.

item
object

Details of the plan.

Show child parameters (4)

notes
object

Notes you can enter of the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Monthly gym membership".

Response Parameters
id
string

The unique identifier linked to a plan. For example, plan_00000000000001. This ID is used when creating a subscription for a customer.

entity
string

The entity being created. Here, it is plan.

interval
integer

Used together with period to define how often the customer should be charged.

period
string

Used together with interval to define how often the customer should be charged. Possible values:

  • daily
  • weekly
  • monthly
  • yearly

item
array

Details of the plan.

Show child parameters (5)

notes
object

Notes you can enter of the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Monthly Gym".

created_at
integer

The Unix timestamp at which the plan was created.

Errors

offer_id is/are not required and should not be sent

Error Status: 400

This error occurs when you are passing offer_id parameter in the request body.

Solution

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X POST https://api.razorpay.com/v1/plans \
3
-H "Content-Type: application/json" \
4
-d '{
5
"period": "weekly",
6
"interval": 1,
7
"item": {
8
"name": "Test plan - Weekly",
9
"amount": 69900,
10
"currency": "MYR",
11
"description": "Description for the test plan"
12
},
13
"notes": {
14
"notes_key_1": "Tea, Earl Grey, Hot",
15
"notes_key_2": "Tea, Earl Grey… decaf."
16
}
17
}'

Success

Failure

1
{
2
"id":"plan_00000000000001",
3
"entity":"plan",
4
"interval":1,
5
"period":"weekly",
6
"item":{
7
"id":"item_00000000000001",
8
"active":true,
9
"name":"Test plan - Weekly",
10
"description":"Description for the test plan - Weekly",
11
"amount":69900,
12
"unit_amount":69900,
13
"currency":"MYR",
14
"type":"plan",
15
"unit":null,
16
"tax_inclusive":false,
17
"hsn_code":null,
18
"sac_code":null,
19
"tax_rate":null,
20
"tax_id":null,
21
"tax_group_id":null,
22
"created_at":1580219935,
23
"updated_at":1580219935
24
},
25
"notes":{
26
"notes_key_1":"Tea, Earl Grey, Hot",
27
"notes_key_2":"Tea, Earl Grey… decaf."
28
},
29
"created_at":1580219935
30
}