# Cancel a customer’s subscription

URL: /products/offers/cancel-a-subscription · Id: `guide:cancel-a-subscription`

> Say "cancel this customer’s subscription" and it stops renewing at the end of the paid period, with access kept until then.

Cancelling ends a [Subscription](/business/nouns/subscription) at the close of its current period: it stops renewing, and the [Customer](/business/nouns/customer) keeps access until then. To stop billing for a while without ending it, [pause](/business/nouns/subscription/pause) it.

Needs: [Charge monthly](/systems/finance/charge-monthly) · [Open a bank account](/systems/finance/open-a-bank-account)

**Before it runs**

- You leave the chat: Never: it all happens in the chat.

## What you get
- 1 Subscription that stops renewing at the end of the paid period (Subscription)
- 1 access kept until that date (Entitlement)
- 1 Customer record kept, with the reason they gave (Customer)

## Your agent does
**For agents**

- Guide: `guide:cancel-a-subscription`, status `live`. Page: [/products/offers/cancel-a-subscription.md](/products/offers/cancel-a-subscription.md).
- Approval: none. Run it when the founder asks.
- Leaves the chat: never.
- Needs first: [Charge monthly](/systems/finance/charge-monthly), [Open a bank account](/systems/finance/open-a-bank-account).
- Run: call the steps in order, each through the API, SDK, CLI or MCP tab below; a later step passes the `$id` an earlier one returns. Each value marked example is the sample business’s: pass the founder’s own.

| Step | Verb | Inputs (type, required, this guide’s value) | Returns |
| --- | --- | --- | --- |
| 1 | [`Subscription.unsubscribe`](/business/nouns/subscription/unsubscribe) (`verb:Subscription.unsubscribe`) | `subscription` Subscription (an id), required: example `"subscription_riverside"`; `reason` text: example `"Moving to a property manager with its own software."` | `subscription` Subscription |

Returns: the last call answers with `subscription` and its `action`, whose `status` is `done`, `pending` (waiting on an Approval or a Worker), `failed`, `canceled` or `refused`:

```json
{
  "api": "https://api.sb/leaseline.app",
  "subscription": {
    "$id": "https://api.sb/leaseline.app/subscriptions/subscription_riverside",
    "$type": "Subscription",
    "status": "canceled"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_1",
    "operation": "Subscription.unsubscribe",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/action_1"
  }
}
```

Next: offer “Pause it for a month instead”, or “Refund their last invoice too”.

Calls: `Subscription.unsubscribe`

Ask:

```text
Cancel a customer’s subscription.
Cancel Riverside’s plan.
Stop billing this customer.
```

API:

```bash
# Subscription.unsubscribe
curl -X POST https://api.sb/leaseline.app/subscriptions/subscription_riverside/unsubscribe \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Moving to a property manager with its own software."}'
```

SDK:

```ts
import { $ } from 'startup-builder'

await $.Subscription.unsubscribe({ subscription: 'subscription_riverside', reason: 'Moving to a property manager with its own software.' })
```

CLI:

```bash
npx startup-builder do Subscription.unsubscribe --json '{"subscription":"subscription_riverside","reason":"Moving to a property manager with its own software."}'
```

MCP:

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Subscription.unsubscribe({ subscription: 'subscription_riverside', reason: 'Moving to a property manager with its own software.' })"
  }
}
```

## Change it
- Pause it for a month instead.
- Refund their last invoice too.
- Ask why they are leaving before it ends.

## Under the hood
- Systems: [Billing](/systems/billing)
- Nouns: [Subscription](/business/nouns/subscription), [Customer](/business/nouns/customer), [Entitlement](/business/nouns/entitlement)
- Events: [`Subscription.unsubscribed`](/business/events/Subscription.unsubscribed)
- Stripe objects: `Subscription`