Skip to main content
PATCH
Available in🇮🇳 India🇸🇬 Singapore🇺🇸 United States
Use this endpoint to update a Subscription.

Path Parameters

string
required
The unique identifier linked to a Subscription. For example, sub_00000000000001.

Request Parameters

string
The unique identifier of the new plan that should be linked to the Subscription. For example, plan_00000000000001.
string
The unique identifier of the offer that should be linked to the Subscription. You can obtain this from the Dashboard. For example, offer_JHD834hjbxzhd38d.
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.
integer
This parameter is used to update the total_count for a Subscription. For example, let us consider a monthly Subscription with 12 billing cycles. The Subscription has been charged successfully 4 times and 3 more invoices have been issued, but have not been charged. The remaining count in such cases is 5. However, you can overwrite this value using this parameter.
integer
Unix timestamp. The new start date for the Subscription.
string
Represents when the Subscription should be updated.
  • now (default): Updates the Subscription immediately.
  • cycle_end: Updates the Subscription at the end of the current billing cycle.
boolean
Represents who sends notifications to the customer. Possible values:
  • true (default): Notifications sent by Razorpay.
  • false: Notifications sent by you.

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.

Errors

Code: 400This error occurs when you are trying to update a Subscription authorised via UPI.Solution: You cannot update a Subscription authorised via UPI mode or Emandate.
Code: 400This error occurs when you are trying to update a Subscription in the created state.Solution: Ensure that the Subscription status is either in the authenticated or active state.
Code: 400The PATCH request body is empty. At least one updatable field must be provided.Solution: Include at least one of the updatable fields (plan_id, quantity, remaining_count, schedule_change_at) in the request body.
Code: 400remaining_count was passed as 0 or a negative value.Solution: Pass remaining_count as a positive integer.
Code: 400The request body contains fields that are not updatable on a Subscription.Solution: Only include updatable fields (plan_id, quantity, remaining_count, schedule_change_at).
Code: 400The Subscription was authenticated via Emandate. Emandate subscriptions cannot be updated through this API.Solution: Emandate subscriptions are immutable post-authentication. Cancel and create a new Subscription if changes are needed.
Code: 400A concurrent update, cancel or pause/resume operation is already running for the same Subscription. Razorpay holds a short-lived lock against the subscription id to prevent state-corruption.Solution: Wait a few seconds and retry. If the issue persists, fetch the Subscription to confirm its current state before retrying.
Code: 400A plan_id change has been requested that downgrades the Subscription amount, but the Subscription has an active offer attached. Downgrades on offer-linked subscriptions are only allowed at the end of the current billing cycle.Solution: Pass schedule_change_at: "cycle_end" so the downgrade is applied at the end of the current cycle, or remove the offer first.