Skip to main content
POST
Available in🇮🇳 India🇸🇬 Singapore🇺🇸 United States
Use this endpoint to link an existing Offer by creating a new Subscription link. Pass the offer_id: <offer_id> parameter in the request when creating a Subscription.

Request Parameters

string
required
The unique identifier of a plan that should be linked to the Subscription. For example, plan_00000000000001.
integer
required
The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year subscription billed on a bi-monthly basis, this value should be 6.
integer
The number of times the customer should be charged the plan amount per invoice. For example, a customer subscribes to use software. The charges are ₹100 /month/license. The customer wants 5 licenses. You should pass 5 as the quantity. The customer is charged ₹500 (5 x ₹100) monthly. By default, this value is set to 1.
integer
Unix timestamp that indicates from when the Subscription should start. If not passed, the Subscription starts immediately after the authorisation payment. For example, 1581013800. For Subscriptions with a future start_date, frequency is considered as_presented.
integer
Unix timestamp that indicates till when the customer can make the authorisation payment. For example, 1581013800. The default value is 30 years. Do not pass any value if you do not want to set an expiry date.
boolean
Indicates whether the communication to the customer would be handled by businesses or Razorpay. Possible values:
  • true (default): Communication handled by Razorpay.
  • false: Communication handled by businesses.
object
Array that contains details of any upfront amount you want to collect as part of the authorisation transaction.
object
Details of the upfront amount you want to charge your customer.
string
A name for the upfront amount you want to charge the customer. For example, Delivery Fee.
integer
The upfront amount in the currency subunit you want to charge the customer. For example ,30000.
string
The currency in which you want to charge the customer. This has to match the plan currency. For example, INR.
string
The unique identifier of the offer that is linked to the Subscription. You can obtain this from the Dashboard. For example, offer_JHD834hjbxzhd38d.
object
Notes you can enter for 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": "Beam me up Scotty”.

Response Parameters

string
The unique identifier of the subscription created. For example, sub_00000000000001.
string
The entity being created. Here, it will be subscription.
string
The unique identifier for a plan that is linked to the created subscription. For example, plan_00000000000001.
string
The unique identifier of the customer linked to the subscription. This is populated automatically once the customer completes the authorisation transaction. For example, cust_00000000000001.
string
Status of the subscription. Refer to the life cycle section for more details. Possible values:
  • created
  • authenticated
  • active
  • pending
  • halted
  • cancelled
  • completed
  • expired
integer
Unix timestamp. The start time of the current billing cycle of the subscription. For example, 1581013800.
integer
Unix timestamp. The end time of the current billing cycle of the subscription. For example, 1581013800.
integer
The timestamp, in Unix format, when the subscription was completed or was cancelled. For example, 1581013800.
integer
The number of times the plan should be linked to the subscription. For example, if the plan is ₹100/user/month and the customer has 5 users, you should pass 5 as the quantity to have the customer charged ₹500 (5 x ₹100) monthly. By default, this value is set to 1.
object
Notes you can enter for 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": "Beam me up Scotty”.
integer
Unix timestamp. This indicates when the next charge on the subscription should be made. For example, 1581013800.
string
The unique identifier of the offer that should be linked to the subscription. For example, offer_JHD834hjbxzhd38d.
integer
The timestamp, in Unix format, when the subscription should start. If not passed, the subscription starts immediately after the authorisation payment. For example, 1581013800.
integer
The timestamp, in Unix format, when the subscription should end. For example, 1581013800.
integer
The number of times that the charge for the current billing cycle has been attempted on the card. For example, 2.
integer
The number of billing cycles for which the customer should be charged. For example, 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.
integer
This indicates the number of billing cycles for which the customer has already been charged. For example, 2.
boolean
Indicates whether the communication to the customer would be handled by businesses or Razorpay.
  • true: Communication handled by Razorpay. Defaults to true.
  • false: Communication handled by businesses.
integer
The timestamp, in Unix format, when the subscription was created. For example, 1581013800.
integer
The timestamp, in Unix format, till when the customer can make the authorisation payment. For example, 1581013800.
string
URL that can be used to make the authorisation payment. For example, https://rzp.io/i/PWtAiEo.
boolean
Indicates if the subscription has any scheduled changes. Possible values:
  • true: Subscription has scheduled changes.
  • false: Subscription does not have scheduled changes.
string
Represents when the subscription should be updated. Possible values:
  • now (default): Updates the subscription immediately.
  • cycle_end: Updates the subscription at the end of the current billing cycle.
integer
This indicates the number of billing cycles remaining on the subscription. For example, 2.
string
The customer’s email address associated with the subscription.
integer
Timestamp, in Unix format, when a scheduled update on this subscription is set to take effect. null when no update is pending.
string
The origin of the subscription. One of api (created via API), dashboard, or links.

Errors

Code: 400The offer_id does not exist on the merchant account. Returned when a well-formed but non-existent offer id is passed.Solution: Use a valid offer_id from an active offer created on the Dashboard.
Code: 400The value passed for offer_id is not in the expected offer_<14 alphanumeric chars> format (20 characters total). Returned for malformed or wrong-prefix offer ids.Solution: Pass offer_id in the form offer_<14 alphanumeric chars>.
Code: 400An empty string was passed for offer_id.Solution: Either omit offer_id from the request body, or pass a valid offer id.
Code: 400The offer’s discount brings the plan amount below the minimum payable amount for the currency (₹1.00 for INR). Returned when applying the offer would make the per-cycle charge invalid.Solution: Either use an offer with a smaller discount, or pick a plan with a higher per-cycle amount.
Code: 400The offer exists but is not applicable for the supplied subscription. This typically happens because the offer’s currency, payment-method scope, plan-eligibility list or validity window does not match the subscription.Solution: Use an offer that is applicable for the subscription’s plan, currency and payment method. You can review an offer’s applicability rules from the Razorpay Dashboard.