
# cancelSubscription

<InternalOnly>
<Note type="warning">
  This intent is only available for projects using the [Payments API](/payments). It is not compatible with projects using the [Billing API](/billing).
</Note>
</InternalOnly>

This will open Connect on the subscription settings page. However, it does **not automatically cancel** the subscription. User action is still needed. Upon successful cancellation,
users will be redirected back to `callbackUrl` if provided.

![cancelSubscription.jpg](https://i.gigscdn.net/docs/v1/connect-session-cancelSubscription.jpg)

The request expects a `cancelSubscription` object that defines the `subscription` to cancel:

<CodeGroup title="Creating a Connect Session with cancelSubscription intent">
```bash
$ curl --request "POST" \
--url "https://api.gigs.com/projects/${GIGS_PROJECT}/connectSessions" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${GIGS_TOKEN}" \
--data '{
  "callbackUrl": "https://example.com",
  "intent": {
    "type": "cancelSubscription",
    "cancelSubscription": {
      "subscription": "sub_0U32VAxJ0Z7P8Y40mBAnOP9LPhEr"
    }
  },
  "user": "usr_0U2ViuFW0Z7P8Y2S1L76mfADMT6m"
}'
```
</CodeGroup>

**Note:** Ensure the subscription is cancelable (i.e., it has no `endedAt` set and is of type `recurring`) before creating a Connect Session, as this is not validated for you. If you redirect the user to a non-cancelable subscription, Connect will still open the subscription details view, but the cancel button will not be present. This might be confusing to users.

## Where to go from here

- Read the [Connect Sessions API Documentation][create-connect-session]
- Reach out to [support@gigs.com](mailto:support@gigs.com) for assistance

[create-connect-session]: /connect/connect-sessions#create-a-connect-session
