> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# customerSubscriptionCancel

> Cancel a subscription in Recharge, as the help desk ticket sidebar's Cancel subscription does: it stops charging and can't be resumed here. With a reason, Recharge records it as the cancellation reason. Recharge may tell the customer, as it does for a cancel in the app. Returns the canceled subscription, or null if the store has no such subscription.

**Required scopes:** [`subscriptions_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-subscriptions_write)

## Arguments

**id** `ID!` *required*

The id of the subscription to cancel.

**reason** `String`

Why it was canceled, stored in Recharge. Omit to cancel without one, as the app does.

## Returns

**customerSubscriptionCancel** `[CustomerSubscription](/docs/api-reference/v3/reference/customers/customer-subscription)`

A customer's subscription in the store's subscription provider (Recharge), as the help desk ticket sidebar shows it.

**fields**

**canceledAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When it was canceled. Null unless it is canceled.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When it was created in the provider.

**externalReference** `[ExternalReference!](/docs/api-reference/v3/reference/common/external-reference)` *required*

Its id in the subscription provider (provider recharge, type subscription), for opening it there.

**fields**

**externalId** `String!` *required*

The id the provider's current API accepts. For Shopify that is the gid, such as gid://shopify/Product/123.

**name** `String`

The record's display name in that system, when known.

**provider** `String!` *required*

The other system, in lowercase, such as shopify or recharge.

**type** `String`

The kind of record when the provider holds several for one entity, such as product or variant. Null when it holds one.

**frequency** `[CustomerSubscriptionFrequency](/docs/api-reference/v3/reference/customers/customer-subscription-frequency)`

How often it delivers. Null when the provider has no schedule for it.

**fields**

**interval** `Int!` *required*

How many units pass between deliveries.

**unit** `[CustomerSubscriptionIntervalUnit!](/docs/api-reference/v3/reference/customers/customer-subscription-interval-unit)` *required*

The unit `interval` counts in.

**id** `ID!` *required*

The id of this subscription.

**nextChargeDate** `[Date](/docs/api-reference/v3/reference/common/date)`

The day the next charge is scheduled, in the store's subscription provider. Null when none is scheduled, as for a canceled subscription. `customerSubscriptionSkip` takes this date.

**price** `[Money](/docs/api-reference/v3/reference/common/money)`

The price of one unit on each charge, in the subscription's currency. Null when the provider doesn't report the currency.

**fields**

**amount** `[Decimal!](/docs/api-reference/v3/reference/common/decimal)` *required*

The exact amount as a decimal string (e.g. "19.99").

**currency** `String!` *required*

ISO 4217 currency code (e.g. USD).

**product** `[CustomerSubscriptionProduct](/docs/api-reference/v3/reference/customers/customer-subscription-product)`

What it delivers. Null when the product isn't in the store's catalog.

**fields**

**externalReferences** `[\[ExternalReference!\]!](/docs/api-reference/v3/reference/common/external-reference)` *required*

The product's Shopify id (type product) and, when the subscription names one, its variant's (type variant).

**fields**

**externalId** `String!` *required*

The id the provider's current API accepts. For Shopify that is the gid, such as gid://shopify/Product/123.

**name** `String`

The record's display name in that system, when known.

**provider** `String!` *required*

The other system, in lowercase, such as shopify or recharge.

**type** `String`

The kind of record when the provider holds several for one entity, such as product or variant. Null when it holds one.

**imageUrl** `String`

The product's first image. Null when it has none.

**title** `String!` *required*

The product's name.

**variantTitle** `String`

The variant's option values joined with " / ", such as "Large / Blue": the variant the subscription names, else the product's first. Null when the variant has no options.

**quantity** `Int!` *required*

How many units each delivery holds.

**shippingAddress** `[MailingAddress](/docs/api-reference/v3/reference/common/mailing-address)`

Where deliveries ship. `country` is null; read `countryCode`. Null when the provider has no address for it.

**fields**

**address1** `String`

The first line of the address (street and number).

**address2** `String`

The second line of the address (apartment, suite, unit, etc.).

**city** `String`

The city, town, or village.

**country** `String`

The country.

**countryCode** `[CountryCode](/docs/api-reference/v3/reference/common/country-code)`

The country as an ISO 3166-1 alpha-2 code. Null where the source keeps only the country's name.

**postalCode** `String`

The postal or ZIP code.

**province** `String`

The province, state, or region.

**status** `[CustomerSubscriptionStatus!](/docs/api-reference/v3/reference/customers/customer-subscription-status)` *required*

Whether it is active, canceled or expired.

**updatedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the provider last changed it.

## Errors

Besides the [errors any request can return](https://developers.redo.com/docs/api-reference/v3/errors.md), this operation fails with these codes in `extensions.code`.

| Code | HTTP status | Meaning | Retry |
| - | - | - | - |
| `API_TOKEN_REQUIRED` | `403` | The credential has no API token to attribute the change to, such as a first-party token. Nothing was sent. | Call with a store API token. |
| `BAD_USER_INPUT` | `400` | An argument is invalid, or names something the store doesn't have. The message says which. Nothing was written. | Fix the input the message names, then send it again. |
| `ACTION_REJECTED` | `422` | The record can't take the action now, or the platform it belongs to refused it. The message says why, in words a merchant can act on. | Act on the message, such as reconnecting the store's account, then send it again. A platform rate limit clears on its own after a few minutes. |
| `TRY_AGAIN` | `503` | The change couldn't start for a passing reason, and nothing was written or sent. | Send the same request again after a short wait, with the same idempotencyKey if it has one. |
| `INTERNAL_SERVER_ERROR` | `500` | Something failed on Redo's side. The change may or may not have been made. | Read the record to see whether the change was made before sending it again. A send with an idempotencyKey is safe to retry with the same key. |

## Example

```graphql theme={null}
mutation {
  customerSubscriptionCancel(id: "...", reason: "...") {
    canceledAt
    createdAt
    id
    nextChargeDate
    quantity
    status
    updatedAt
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.