Subscriptions
Cancel an Update
Cancel an update using the Razorpay API.
POST
Use this endpoint to cancel a pending update. This happens when a Subscription is updated using the
Example
A Subscription is to be charged on the 1st of every month. It was charged on January 01, 2021. On January 15, 2021, it was updated using the
end of cycle option for the schedule_change_at parameter.Example
A Subscription is to be charged on the 1st of every month. It was charged on January 01, 2021. On January 15, 2021, it was updated using the
end of cycle option for the schedule_change_at parameter. In this case, the update goes live after the Subscription is charged on February 01, 2021. Such updates are said to be scheduled updates and can be cancelled using this API.
Handy TipsYou can only cancel a pending update for a subscription. You cannot cancel an update once it is live.
Path Parameters
string
required
The unique identifier linked to a Subscription. For example,
sub_00000000000001.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:
createdauthenticatedactivependinghaltedcancelledcompletedexpired
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 totrue.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
The API key/secret provided is invalid.
The API key/secret provided is invalid.
Code:
4xxThis error occurs due to a mismatch between the API credentials passed in the API call and those generated on the Dashboard.Solution: Ensure that the API keys are active and correctly entered, with no whitespaces before or after the keys.No Pending update for this subscription.
No Pending update for this subscription.
Code:
400There is no scheduled update on the subscription to cancel. This endpoint is only meaningful after a PATCH /v1/subscriptions/:id with a schedule_change_at value.Solution: Schedule an update first via the Update Subscription endpoint, then call this endpoint to cancel it before it takes effect.The id provided is invalid or could not be found.
The id provided is invalid or could not be found.
Code:
400The subscription id in the URL is malformed (for example a wrong-prefix id like pay_...) or does not exist.Solution: Pass a valid subscription id (sub_<14 alphanumeric chars>).