API Test Keys
Create a Plan
POST/v1/plansClick to copy
Use this endpoint to create a plan.
Is this page helpful?
1curl -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": "",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":"",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":158021993524},25"notes":{26"notes_key_1":"Tea, Earl Grey, Hot",27"notes_key_2":"Tea, Earl Grey… decaf."28},29"created_at":158021993530}
Request Parameters
period *
string This, combined with interval, defines the frequency of the plan. Possible values:
dailyweeklymonthlyquarterlyyearly
interval *
integer This, combined with period, defines the frequency of the plan. If the billing cycle is 2 months, the value should be 2. For daily plans, the minimum value should be 7.
itemobjectDetails 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
idstring The unique identifier linked to a plan. For example, plan_00000000000001. This ID is used when creating a subscription for a customer.
entitystring The entity being created. Here, it is plan.
intervalinteger Used together with period to define how often the customer should be charged.
periodstring Used together with interval to define how often the customer should be charged. Possible values:
dailyweeklymonthlyyearly
itemarrayDetails of the plan.
Show child parameters (5)
notesobject 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_atintegerThe Unix timestamp at which the plan was created.
Errors
Authentication failed
Error Status: 401
This error occurs when you use incorrect or invalid API Keys.
Solution
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/plansClick 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:
dailyweeklymonthlyquarterlyyearly
interval *
integer This, combined with period, defines the frequency of the plan. If the billing cycle is 2 months, the value should be 2. For daily plans, the minimum value should be 7.
itemobjectDetails 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
idstring The unique identifier linked to a plan. For example, plan_00000000000001. This ID is used when creating a subscription for a customer.
entitystring The entity being created. Here, it is plan.
intervalinteger Used together with period to define how often the customer should be charged.
periodstring Used together with interval to define how often the customer should be charged. Possible values:
dailyweeklymonthlyyearly
itemarrayDetails of the plan.
Show child parameters (5)
notesobject 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_atintegerThe Unix timestamp at which the plan was created.
Errors
Authentication failed
Error Status: 401
This error occurs when you use incorrect or invalid API Keys.
Solution
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
1curl -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": "",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":"",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":158021993524},25"notes":{26"notes_key_1":"Tea, Earl Grey, Hot",27"notes_key_2":"Tea, Earl Grey… decaf."28},29"created_at":158021993530}