# Cancelling a subscription

Cancelling a subscription is an important feature of subscription management. It allows users or administrators to terminate recurring services or products. This document explains how to cancel a shopper's subscription within our system. It ensures a smooth transition and user experience when a subscription is no longer needed or desired.

When cancelling a subscription, setting `suppressCancelNotification` to `true` is crucial in certain scenarios, such as when:

* You want to manage how and when you notify the customer about the cancellation, perhaps through a custom messaging or email system.
* You're performing bulk cancellations and wish to avoid spamming your users with multiple notifications.
* The cancellation is part of a larger account or service modification process where notifications are handled separately or at a later stage.

This option provides flexibility in managing the user experience around subscription cancellations.

To cancel a subscription immediately, send a [`POST /v1/subscriptions/{subscriptionId}/cancel`](https://docs.digitalriver.com/commerce-api-references/admin-apis/subscription-mangement/manage-a-subscription#v1-subscriptions-subid-cancel) request. Replace `{subscriptionId}` with the actual ID of the subscription you wish to cancel. You can include the following parameters in the request body:

* **suppressCancelNotification**: Set the `suppressCancelNotification` parameter to `true` to suppress the cancellation notification email. By default, this value is `false`.
* **cancelReasonCode**: This optional parameter allows you to specify a code that categorizes the reason for the subscription cancellation. This field can contain up to 64 characters. It helps organize and analyze why users are canceling their subscriptions. Example: `"cancelReasonCode": "user_unsubscribe"`.
* **cancelComment**: This optional parameter includes the shopper's comment to provide additional context regarding the subscription cancellation. This field can contain up to 255 characters. It can include any details that might be relevant for future reference or customer service teams. Example: `"cancelComment": "I cancelled the subscription due to budget constraints."`

{% tabs %}
{% tab title="cURL" %}

```javascript
curl --location --request POST 'https://{host}>/v1/subscriptions/{subscriptionId}/cancel' \
--header 'Content-Type:  application/json' \
--header 'authorization: bearer {YOUR_ACCESS_TOKEN}'\
--data-raw '{
 "suppressCancelNotification" : true,
 "cancelReasonCode" : "user_unsubscribe",
 "cancelComment" : "I cancelled the subscription due to budget constraints."
}'
```

{% endtab %}
{% endtabs %}

After executing the request, you will receive a `202 Accepted` response if successful. The cancellation will go into effect immediately.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/admin-apis/subscription-management/immediately-change-the-subscription/cancelling-a-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
