Create a Subscription
Create a Subscription using the Razorpay API.
Request Parameters
plan_00000000000001.6.5 as the quantity. The customer is charged ₹500 (5 x ₹100) monthly. By default, this value is set to 1.1581013800. For Subscriptions with a future start_date, frequency is considered as_presented.1581013800. The default value is 30 years. Do not pass any value if you do not want to set an expiry date.true(default): Communication handled by Razorpay.false: Communication handled by businesses.
Delivery Fee.30000.INR.offer_JHD834hjbxzhd38d."note_key": "Beam me up Scotty”.Response Parameters
sub_00000000000001.subscription.plan_00000000000001.cust_00000000000001.createdauthenticatedactivependinghaltedcancelledcompletedexpired
1581013800.1581013800.1581013800."note_key": "Beam me up Scotty”.1581013800.offer_JHD834hjbxzhd38d.1581013800.1581013800.2.2. We support subscriptions for a maximum duration of 100 years. The number of billing cycles depends if the subscription is daily, weekly, monthly or yearly.2.true: Communication handled by Razorpay. Defaults totrue.false: Communication handled by businesses.
1581013800.1581013800.https://rzp.io/i/PWtAiEo.true: Subscription has scheduled changes.false: Subscription does not have scheduled changes.
now(default): Updates the subscription immediately.cycle_end: Updates the subscription at the end of the current billing cycle.
2.Errors
The requested URL was not found on the server.
The requested URL was not found on the server.
400This error occurs when the Subscriptions feature is not enabled.Solution: Ensure that the Subscriptions feature is enabled both in the test and live modes before creating a Subscription.The id provided does not exist
The id provided does not exist
400This error occurs when passing an incorrect plan_id.Solution: Ensure that you are passing the correct plan_id. The plan should be active and created using the same API key and Secret.Offer Not Found
Offer Not Found
400This error occurs when you are linking an invalid/expired offer to a Subscription.Solution: Ensure that the Subscription offer created on the Dashboard is valid and has not expired.Offer not applicable for this Subscription
Offer not applicable for this Subscription
400This error occurs when you are linking/passing an offer_id to a Subscription on which the offer doesn’t apply.Solution: Ensure that the plan amount is greater than the minimum amount set for the offer.The plan id field is required.
The plan id field is required.
400The plan_id was not included in the request body.Solution: Pass plan_id (the id of an active plan in the same account).The plan id must be 19 characters.
The plan id must be 19 characters.
400The value passed for plan_id is not 19 characters long (the expected plan_<14 alphanumeric chars> format).Solution: Pass plan_id in the form plan_<14 alphanumeric chars>.The total count field is required when end at is not present.
The total count field is required when end at is not present.
400Neither total_count nor end_at was included in the request body. At least one is required to bound the subscription.Solution: Pass either total_count (number of billing cycles) or end_at (UNIX timestamp).The total count must be at least 1.
The total count must be at least 1.
400total_count was passed as 0 or a negative value.Solution: Pass total_count as a positive integer (1 or higher).The total count must be an integer.
The total count must be an integer.
400A non-integer value was passed for total_count.Solution: Pass total_count as an integer.The quantity must be at least 1.
The quantity must be at least 1.
400quantity was passed as 0 or a negative value.Solution: Pass quantity as a positive integer (1 or higher).start_at cannot be lesser than the current time.
start_at cannot be lesser than the current time.
400start_at is set to a past UNIX timestamp.Solution: Pass start_at as a UNIX timestamp in the future.The customer notify field must be true or false.
The customer notify field must be true or false.
400A non-boolean value (for example a string like "maybe") was passed for customer_notify.Solution: Pass customer_notify as a boolean (true/false) or as 1/0.{any extra field} is/are not required and should not be sent.
{any extra field} is/are not required and should not be sent.
400The request body contains fields that are not part of the Subscriptions API schema.Solution: Only include documented fields in the request body.Please provide either an end date or a total count, but not both.
Please provide either an end date or a total count, but not both.
400Both end_at and total_count were sent together. The subscription end can be defined either by an explicit end date or by a count of cycles, not both.Solution: Pass either end_at or total_count, but not both.