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
The period field is required.
Error Status: 400
The period field was not included in the request body.
Solution
Invalid argument for period passed.
Error Status: 400
The value passed for period is not one of the supported values.
Solution
The interval field is required.
Error Status: 400
The interval field was not included in the request body.
Solution
The interval must be at least 1.
Error Status: 400
The interval value is 0 or negative.
Solution
The interval must be an integer.
Error Status: 400
A non-integer value was passed for interval.
Solution
The item id field is required when item is not present.
Error Status: 400
Neither the item object nor an item_id was included in the request body.
Solution
The name field is required.
Error Status: 400
The item.name field was not included in the inline item object.
Solution
The amount field is required when unit amount is not present.
Error Status: 400
Neither item.amount nor item.unit_amount was included in the request body.
Solution
The amount must be valid integer between 0 and 4294967295.
Error Status: 400
A negative or out-of-range value was passed for item.amount.
Solution
Currency provided is not supported.
Error Status: 400
The item.currency value is not one of the supported ISO currency codes.
Solution
{any extra field} is/are not required and should not be sent.
Error Status: 400
The request body contains fields that are not part of the Plans API schema.
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
The period field is required.
Error Status: 400
The period field was not included in the request body.
Solution
Invalid argument for period passed.
Error Status: 400
The value passed for period is not one of the supported values.
Solution
The interval field is required.
Error Status: 400
The interval field was not included in the request body.
Solution
The interval must be at least 1.
Error Status: 400
The interval value is 0 or negative.
Solution
The interval must be an integer.
Error Status: 400
A non-integer value was passed for interval.
Solution
The item id field is required when item is not present.
Error Status: 400
Neither the item object nor an item_id was included in the request body.
Solution
The name field is required.
Error Status: 400
The item.name field was not included in the inline item object.
Solution
The amount field is required when unit amount is not present.
Error Status: 400
Neither item.amount nor item.unit_amount was included in the request body.
Solution
The amount must be valid integer between 0 and 4294967295.
Error Status: 400
A negative or out-of-range value was passed for item.amount.
Solution
Currency provided is not supported.
Error Status: 400
The item.currency value is not one of the supported ISO currency codes.
Solution
{any extra field} is/are not required and should not be sent.
Error Status: 400
The request body contains fields that are not part of the Plans API schema.
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}