# PostSubscriptionSchedulesScheduleCancel

From **Stripe API**.

`POST /v1/subscription_schedules/{schedule}/cancel`

<p>Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is <code>not_started</code> or <code>active</code>.</p>

## Parameters

### `schedule`

- Location: path
- Required: true
- Type: `string`
- maxLength: `5000`

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"invoice_now":{"description":"If the subscription schedule is `active`, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to `true`.","type":"boolean"},"prorate":{"description":"If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`.","type":"boolean"}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.

Related guide: [Subscription Schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules).

```json
{"description":"A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.\n\nRelated guide: [Subscription Schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules).","properties":{"canceled_at":{"description":"Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.","format":"unix-time","nullable":true,"type":"integer"},"completed_at":{"description":"Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.","format":"unix-time","nullable":true,"type":"integer"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"current_phase":{"anyOf":[{"$ref":"#/components/schemas/subscription_schedule_current_phase"}],"description":"Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`.","nullable":true},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}],"description":"ID of the customer who owns the subscription schedule.","x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}]}},"default_settings":{"$ref":"#/components/schemas/subscription_schedules_resource_default_settings"},"end_behavior":{"description":"Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` and `cancel`.","enum":["cancel","none","release","renew"],"type":"string"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["subscription_schedule"],"type":"string"},"phases":{"description":"Configuration for the subscription schedule's phases.","items":{"$ref":"#/components/schemas/subscription_schedule_phase_configuration"},"type":"array"},"released_at":{"description":"Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.","format":"unix-time","nullable":true,"type":"integer"},"released_subscription":{"description":"ID of the subscription once managed by the subscription schedule (if it is released).","maxLength":5000,"nullable":true,"type":"string"},"status":{"description":"The present status of the subscription schedule. Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules).","enum":["active","canceled","completed","not_started","released"],"type":"string"},"subscription":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/subscription"}],"description":"ID of the subscription managed by the subscription schedule.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/subscription"}]}}},"required":["created","customer","default_settings","end_behavior","id","livemode","object","phases","status"],"title":"SubscriptionSchedule","type":"object","x-expandableFields":["current_phase","customer","default_settings","phases","subscription"],"x-resourceId":"subscription_schedule"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/subscription_schedules/{schedule}/cancel \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "expand": [
    "string"
  ],
  "invoice_now": true,
  "prorate": true
}'
```
