Skip to main content
POST
Available in🇮🇳 India🇸🇬 Singapore🇺🇸 United States
Use this endpoint to cancel a Subscription. You can either cancel the Subscription immediately or at the end of the current billing cycle. Once cancelled, you cannot renew or reactivate it.
  • When you cancel a Subscription, the status changes to cancelled.
  • If you choose to cancel a Subscription at the end of a billing cycle, its status changes to cancelled only at the end of the current billing cycle.

Path Parameters

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

Request Parameters

boolean
Use this parameter to cancel a Subscription at the end of a billing cycle. Possible values:
  • true: Cancel the subscription at the end of the current billing cycle.
  • false (default): Cancel the subscription immediately.

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 phone number associated with the subscription.
string
The customer’s email address associated with the subscription.
string
The payment method used for the subscription, such as card, emandate, or UPI.
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: 400This error occurs when you are trying to cancel a Subscription which is in the expired state.Solution: You cannot cancel a Subscription in the expired state. Ensure that the Subscription is in the active or authenticated state to cancel.
Code: 400The Subscription has already been cancelled.Solution: Cancel can only be called once per subscription. No further action is needed.
Code: 400A non-boolean value (for example a string like "yes") was passed for cancel_at_cycle_end.Solution: Pass cancel_at_cycle_end as a boolean (true/false) or as 1/0.
Code: 400cancel_at_cycle_end: true was passed on a Subscription that does not yet have an active billing cycle (typically when the Subscription is still in the created or authenticated state and the first charge hasn’t fired).Solution: Either cancel immediately by passing cancel_at_cycle_end: false, or wait for the first billing cycle to start before requesting cycle-end cancellation.
Code: 400cancel_at_cycle_end: true was passed but the Subscription is already in its last billing cycle, so there is no subsequent cycle at the end of which to cancel.Solution: Cancel immediately by passing cancel_at_cycle_end: false, or allow the Subscription to complete naturally.
Code: 400A concurrent update, cancel or pause/resume operation is already running for the same Subscription.Solution: Wait a few seconds and retry. Fetch the Subscription to confirm its current state before retrying.