> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.stripe.core.CancelSubscription

- Component: `appmixer.stripe.core.CancelSubscription`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.stripe 3.1.0](https://connectors.appmixer.com/connector/appmixer.stripe/3.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.stripe/3.1.0/component/appmixer.stripe.core.CancelSubscription>

Cancels a subscription immediately. The customer is not charged again for it. Optionally creates a final invoice and prorates the unused time.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Subscription ID (`subscriptionId`) | text | The ID of the subscription to cancel, e.g. sub_1MlPf9LkdIwHu7ixB6VIYRyX. |
| Invoice Now (`invoiceNow`) | toggle | Generate a final invoice for any un-invoiced metered usage and pending proration invoice items. |
| Prorate (`prorate`) | toggle | Generate a proration invoice item that credits the unused time until the end of the period. |
| Cancellation Comment (`cancellationComment`) | text | A comment about why the subscription was canceled, stored in the subscription's cancellation details. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Subscription ID (`id`) | string | - |
| Object (`object`) | string | - |
| Status (`status`) | string | - |
| Customer ID (`customer`) | string | - |
| Canceled At (Unix Timestamp) (`canceled_at`) | integer,null | - |
| Ended At (Unix Timestamp) (`ended_at`) | integer,null | - |
| Latest Invoice ID (`latest_invoice`) | string,null | - |
| Cancellation Details (`cancellation_details`) | object | - |
| Live Mode (`livemode`) | boolean | - |
| Metadata (`metadata`) | object | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.stripe.core.CancelSubscription",
  "description": "Cancels a subscription immediately. The customer is not charged again for it. Optionally creates a final invoice and prorates the unused time.",
  "author": "Appmixer <info@appmixer.com>",
  "version": "1.0.0",
  "auth": {
    "service": "appmixer:stripe"
  },
  "quota": {
    "manager": "appmixer:stripe",
    "resources": "requests"
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "string"
          },
          "invoiceNow": {
            "type": "boolean"
          },
          "prorate": {
            "type": "boolean"
          },
          "cancellationComment": {
            "type": "string"
          }
        },
        "required": [
          "subscriptionId"
        ]
      },
      "inspector": {
        "inputs": {
          "subscriptionId": {
            "type": "text",
            "label": "Subscription ID",
            "index": 1,
            "tooltip": "The ID of the subscription to cancel, e.g. sub_1MlPf9LkdIwHu7ixB6VIYRyX."
          },
          "invoiceNow": {
            "type": "toggle",
            "label": "Invoice Now",
            "index": 2,
            "defaultValue": false,
            "tooltip": "Generate a final invoice for any un-invoiced metered usage and pending proration invoice items."
          },
          "prorate": {
            "type": "toggle",
            "label": "Prorate",
            "index": 3,
            "defaultValue": false,
            "tooltip": "Generate a proration invoice item that credits the unused time until the end of the period."
          },
          "cancellationComment": {
            "type": "text",
            "label": "Cancellation Comment",
            "index": 4,
            "tooltip": "A comment about why the subscription was canceled, stored in the subscription's cancellation details."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "title": "Subscription ID",
            "example": "sub_1MlPf9LkdIwHu7ixB6VIYRyX"
          },
          "object": {
            "type": "string",
            "title": "Object",
            "example": "subscription"
          },
          "status": {
            "type": "string",
            "title": "Status",
            "example": "canceled"
          },
          "customer": {
            "type": "string",
            "title": "Customer ID",
            "example": "cus_NWSaVkvdacCUi4"
          },
          "canceled_at": {
            "type": [
              "integer",
              "null"
            ],
            "title": "Canceled At (Unix Timestamp)",
            "example": 1678768842
          },
          "ended_at": {
            "type": [
              "integer",
              "null"
            ],
            "title": "Ended At (Unix Timestamp)",
            "example": 1678768842
          },
          "latest_invoice": {
            "type": [
              "string",
              "null"
            ],
            "title": "Latest Invoice ID",
            "example": "in_1MlPf9LkdIwHu7ixEo6hdgCw"
          },
          "cancellation_details": {
            "type": "object",
            "title": "Cancellation Details",
            "properties": {
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cancellation Details.Reason",
                "example": "cancellation_requested"
              },
              "comment": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cancellation Details.Comment",
                "example": "Customer closed the account"
              },
              "feedback": {
                "type": [
                  "string",
                  "null"
                ],
                "title": "Cancellation Details.Feedback",
                "example": null
              }
            }
          },
          "livemode": {
            "type": "boolean",
            "title": "Live Mode",
            "example": false
          },
          "metadata": {
            "type": "object",
            "title": "Metadata",
            "example": {
              "orderId": "1001"
            }
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
