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

# Subscriptions

> Lifecycle, pause and resume, cancellation, plan changes and the events to listen for.

A recurring product creates a **subscription** on purchase. Billing cycles are monthly, every 3 or 6 months, or yearly.

## Lifecycle

| Status | Meaning |
| - | - |
| `active` | Paid up |
| `past_due` | A renewal failed. The customer is emailed a link to update their card and the subscription stays usable during the grace period. |
| `paused` | Billing is stopped |
| `canceled` | Ended |
| `incomplete` | First payment not completed |

A failed renewal moves the subscription to `past_due` and fires `subscription.past_due`. Paying recovers it. If the card never recovers, the subscription is revoked and its benefits and license keys are removed.

## Change a subscription from your backend

```ts theme={null}
await sleetpay.subscriptions.cancelAtPeriodEnd(id);        // keeps access until the period ends
await sleetpay.subscriptions.cancelAtPeriodEnd(id, false); // undo it

await sleetpay.subscriptions.pause(id);   // stops billing when the paid period ends
await sleetpay.subscriptions.resume(id);  // undoes a scheduled pause, or restarts billing today if already paused

await sleetpay.subscriptions.changeSeats(id, 8);           // see Seats
await sleetpay.subscriptions.revoke(id);                   // ends it now
```

These need the `subscriptions:write` scope. Customers can also cancel and resume from their [portal](https://docs.sleetpay.com/guides/portal.md), and buyers can switch plans themselves where you allow it.

## Free trials

Set trial days on a recurring product: \$0 today, first charge when the trial ends. `reminder.trial_ending` fires before it does.

## Plan changes

Change plans from **Dashboard > Subscriptions > Change plan**. Proration options are `prorated_immediately`, `difference_immediately`, `full_immediately` and `do_not_bill`. A downgrade never refunds. Seats carry over and must fit the new plan's range.

## Events to listen for

`subscription.created`, `subscription.active`, `subscription.cycled` (renewed), `subscription.past_due`, `subscription.paused`, `subscription.resumed`, `subscription.canceled`, `subscription.uncanceled`, `subscription.revoked`, `subscription.updated`. See [Webhooks](https://docs.sleetpay.com/guides/webhooks.md).

## Related

* [API reference](https://docs.sleetpay.com/api-reference/introduction.md)


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