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

# Subscriptions

> Take recurring payments, list and read subscriptions, and cancel, pause or resume them from your server.

A subscription charges a customer's card or bank account on a schedule until it is cancelled. You can start one two ways. You can then manage it from your server with the `/v1` API, from Console, or let the customer manage it in the portal.

| Start it with | How |
| - | - |
| A Checkout session | `POST /v1/checkout/sessions` with `mode` set to `subscription`. See below |
| A catalog price | A recurring price on a session line (`line_items[].price`). See [Products, prices and promotion codes](https://docs.easner.com/products-and-prices.md) |

Funds land on your business balance, like any Checkout payment.

## Create a subscription session

Use `recurring` (or `interval` and `interval_count` at the top level) and, if you want a trial, `trial_days`. Always send `Idempotency-Key`. The full field list is on [Checkout](https://docs.easner.com/checkout.md).

```bash theme={null}
curl https://api.easner.com/v1/checkout/sessions \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: sub-user_42-pro" \
  -d '{
    "mode": "subscription",
    "currency": "usd",
    "line_items": [{ "name": "Pro plan", "amount": 4900 }],
    "recurring": { "interval": "month", "interval_count": 1 },
    "trial_days": 14,
    "customer_email": "ada@example.com",
    "success_url": "https://yoursite.com/welcome?session_id={CHECKOUT_SESSION_ID}",
    "cancel_url": "https://yoursite.com/pricing"
  }'
```

| Field | Notes |
| - | - |
| `recurring.interval` | `day`, `week`, `month` or `year`. Default `month` |
| `recurring.interval_count` | How many intervals between charges. Billing cannot be less often than once a year |
| `trial_days` | 0 to 730. A free trial charges nothing today (`amount_due_today` is `0`) and the button reads "Start free trial" |
| `payment_method_collection` | `always` (default) or `if_required`. See [Start a trial without a card](#start-a-trial-without-a-card) |
| `trial_end_behavior` | `pause` (default) or `cancel`, with `if_required` |

To bill from a catalog price instead, set `line_items[].price` to a catalog price id. A recurring price makes the session a subscription. Read the session with `GET /v1/checkout/sessions/cs_…`.

## Start a trial without a card

By default a trial still asks for a card, so the first charge can happen on its own. To let a customer start with only an email, send `payment_method_collection: "if_required"` with a trial:

```json theme={null}
{
  "mode": "subscription",
  "line_items": [{ "price": "<price id>", "quantity": 5 }],
  "trial_days": 14,
  "payment_method_collection": "if_required",
  "trial_end_behavior": "pause",
  "customer_email": "ada@example.com",
  "success_url": "https://example.com/welcome?session={CHECKOUT_SESSION_ID}"
}
```

The hosted page shows the email, "14 days free · No card needed" and a **Start free trial** button. No card, wallet or bank form appears, and `amount_due_today` is `0`. The subscription starts as `trialing`, and you get `checkout.completed` and `subscription.created` as usual.

The subscription has `has_payment_method: false` until the customer adds a card. They can add one at any time in the [customer portal](https://docs.easner.com/customer-portal.md) (**Add a card**). When the trial ends:

| Card added | `trial_end_behavior` | What happens |
| - | - | - |
| Yes | any | The first payment is taken and the subscription becomes `active` |
| No | `pause` | The subscription becomes `paused` and you get `subscription.updated` with `status: "paused"` and `has_payment_method: false`. Adding a card in the portal resumes it and takes the first payment right then. You get `subscription.updated` with `status: "active"` |
| No | `cancel` | The subscription ends and you get `subscription.canceled` |

Use `pause` when you want the customer to be able to come back to the same subscription, and `cancel` when you would rather they start again with a new checkout. `subscription.trial_ending` still fires 3 days before the trial ends, so you can ask them to add a card first. A paused trial has `next_charge_at: null`.

## Keep your server in sync

Renewals happen without the customer on your site, so webhooks are your only signal. Unlock access on `checkout.completed`, then follow the subscription:

| Event | When |
| - | - |
| `checkout.completed` | The first payment succeeded, or a free trial started |
| `subscription.updated` | The plan, status or period changed |
| `subscription.canceled` | The subscription ended |
| `subscription.payment_failed` | A renewal could not be charged |
| `subscription.created` | A subscription started. Use it to create access. It fires for trials too |
| `subscription.trial_ending` | The trial ends in 3 days. Nothing is charged yet |

Tick these on a webhook endpoint in Console (Settings, **Webhooks**). See [Webhooks](https://docs.easner.com/webhooks.md) and [Console tools](https://docs.easner.com/console-tools.md).

## Manage a subscription from your server

| Method | Path | Scope | What it does |
| - | - | - | - |
| `GET` | `/v1/subscriptions` | `checkout` | List subscriptions, newest first |
| `GET` | `/v1/subscriptions/:id` | `checkout` | Read one subscription |
| `POST` | `/v1/subscriptions/:id/cancel` | `checkout` | Cancel at the end of the period, or now |
| `POST` | `/v1/subscriptions/:id/pause` | `checkout` | Stop collecting payments |
| `POST` | `/v1/subscriptions/:id/resume` | `checkout` | Start collecting payments again |
| `POST` | `/v1/subscriptions/:id` | `checkout` | Change the seats (`quantity`) or the price |
| `GET` | `/v1/subscriptions/:id/preview` | `checkout.read` | See the charge before a seat or price change |

The id is `sub_…`. Use the same id in webhooks and in Console. A subscription in the other mode, or another business's, is `404 not_found`.

None of these calls moves money. A cancel or a pause stops future charges. It does not refund anything.

### Change seats or price

A per-seat subscription bills `quantity` times the price. Change the seats with `POST /v1/subscriptions/:id`. Send `quantity`, or `price` to move to another recurring price of the same product, or both.

```bash theme={null}
curl -X POST https://api.easner.com/v1/subscriptions/sub_1Nx8a2Lk0Q \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seats-sub_1Nx8a2Lk0Q-7" \
  -d '{ "quantity": 7 }'
```

| Field | Type | Notes |
| - | - | - |
| `quantity` | integer | 1 to 10,000. Refused below the price's `min_quantity` (default 1). One quantity for the subscription, including a tiered price |
| `price` | string | A recurring catalog price of the same product, in the same currency |
| `proration` | string | `create` (default): the difference is charged now, or credited. `none`: no difference is charged or credited |
| `effective` | string | `now` (default): the change applies at once. `period_end`: it applies at the next renewal, with no proration |

At least one of `quantity` or `price` is required. The answer is the subscription, with its new `quantity` and `amount`. A tiered price also returns `tier_breakdown` for that quantity. Seat changes, previews and proration still take the one quantity.

**Adding seats** takes effect at once. The prorated charge is billed now.

**Removing seats** takes effect at once. The prorated credit is held on the customer's balance and applied to the next invoice. Easner never refunds a seat removal through the API. Use `proration: "none"` with `effective: "period_end"` to change the count at the renewal with no credit.

Each change fires `subscription.updated`, and Easner emails the customer the new seat count, the monthly amount from the next renewal and the date. Honours `Idempotency-Key`: a retry with the same key and body answers `200`, not a second change.

### Preview a change

Show the charge before you confirm. The preview is the invoice Easner will bill for the same change, so the number you show and the invoice agree.

```bash theme={null}
curl "https://api.easner.com/v1/subscriptions/sub_1Nx8a2Lk0Q/preview?quantity=7" \
  -H "Authorization: Bearer $EASNER_SECRET_KEY"
```

```json theme={null}
{
  "object": "subscription.preview",
  "subscription": "sub_1Nx8a2Lk0Q",
  "currency": "USD",
  "amount_due_now": 3600,
  "credit": 0,
  "next_invoice_amount": 8400,
  "next_invoice_at": "2026-11-01T00:00:00.000Z",
  "lines": [
    { "description": "Remaining time on 6 seats", "amount": 1800, "proration": true },
    { "description": "Team plan, 7 seats", "amount": 8400, "proration": false }
  ],
  "livemode": false
}
```

`amount_due_now` is what is charged today. `credit` is what is credited to the balance for removed seats. `lines` are the same lines as the invoice. The preview takes the same `quantity`, `price`, `proration` and `effective` as the change, and changes nothing.

### Seats in the customer portal

On a per-seat subscription, a customer can change their own seats in the [customer portal](https://docs.easner.com/customer-portal.md) when you allow it (Settings, **Payments** tab, **Customer portal**, **Change seats**). The portal shows the same preview and asks for a six-digit code first.

### Read and list

```bash theme={null}
curl "https://api.easner.com/v1/subscriptions?status=active&limit=20" \
  -H "Authorization: Bearer $EASNER_SECRET_KEY"
```

Every field is on [List subscriptions](https://docs.easner.com/api-reference/subscriptions/list-subscriptions.md) and [Retrieve a subscription](https://docs.easner.com/api-reference/subscriptions/retrieve-a-subscription.md). Those pages are the contract.

Filters: `status` and `customer`. `status` is one of the statuses below. `customer` is a Checkout customer id (a UUID). A customer that is not yours in this mode is `404 not_found`. Lists also take `limit`, `starting_after` and `created[gte]` / `created[lte]`. See [v1 reference](https://docs.easner.com/reference.md#lists).

| `status` | Meaning |
| - | - |
| `active` | Billing on schedule |
| `trialing` | In a free trial. Nothing is charged until `trial_end` |
| `ending` | Still billing until `ends_at`, then it stops. Set by a cancel at the period end |
| `paused` | Collection is paused, or a no-card trial ended without a card. Invoices are voided while collection is paused. See Pause and resume and [Start a trial without a card](#start-a-trial-without-a-card). `has_payment_method` tells them apart |
| `past_due` | A renewal failed and Easner is retrying |
| `incomplete` | The first payment has not succeeded yet |
| `canceled` | Ended. No more charges |

`next_charge_at` is `null` while the subscription is `ending`, `paused` or `canceled`. `cancel_reason` is the reason the customer gave in the portal, when they gave one.

### Cancel

```bash theme={null}
curl https://api.easner.com/v1/subscriptions/sub_1Nx8a2Lk0Q/cancel \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: cancel-sub_1Nx8a2Lk0Q" \
  -d '{ "at": "period_end" }'
```

| Field | Type | Notes |
| - | - | - |
| `at` | string | Required. `period_end`: the customer keeps access and is not charged again after the current period. `now`: charges stop at once |
| `refund_unused` | boolean | **Console only.** The API does not refund. Sending `true` is `400 invalid_request`. Leave it out or send `false` |

The response is the subscription. After `at: "period_end"` its `status` is `ending` and `ends_at` is the date it stops. After `at: "now"` its `status` is `canceled`.

To refund the unused part of the current period, use Console: open the customer, choose **Cancel subscription**, then **Now**, and tick **Refund the unused part of this period**. That is a money move, so Console asks for a fresh code from your authenticator first.

### Pause and resume

```bash theme={null}
curl -X POST https://api.easner.com/v1/subscriptions/sub_1Nx8a2Lk0Q/pause \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Idempotency-Key: pause-sub_1Nx8a2Lk0Q"
```

Pause stops collection. Open invoices are voided, and no payment is taken until you resume. Nothing is refunded. Resume starts collection again. Both return the subscription with its new `paused` and `status`.

### Idempotency

Send `Idempotency-Key` on cancel, pause and resume, as you do on checkout. One stable key per action, for example `cancel-sub_…`. A retry after a timeout then does not act twice:

| Call | Without the key | With the key |
| - | - | - |
| The first call | Acts | Acts |
| A retry, once the change is already made | `409 invalid_request` (for example "already paused") | `200` with the subscription as it is now |

A key is kept with its business, its subscription and its action. A different body sent with the same key is not compared. The call acts on the subscription as it is when the request arrives.

### Errors

| `code` | HTTP | When |
| - | - | - |
| `not_found` | 404 | No such subscription, customer or payment in this mode for your business |
| `invalid_request` | 400 | `at` is missing or not `period_end` or `now`, or `refund_unused` is `true`. The message says which |
| `invalid_request` | 409 | The change is already made (already paused, not paused, already cancelled) and you sent no `Idempotency-Key` |
| `not_available` | 503 | Easner could not change the subscription with the payment provider. Retry with the same `Idempotency-Key` |
| `rate_limit` | 429 | Over the write budget. `Retry-After: 60` |

## What you can do in Console

Go to **Checkout, Customers** and open a customer. Console has more actions than the API. The **Subscriptions** card lists each subscription with its price, interval, next charge or end date, and a status badge. The actions menu offers:

| Action | What it does | On the API |
| - | - | - |
| **Pause** and **Resume collection** | Stops and restarts collection | Yes: `pause`, `resume` |
| **Cancel subscription** | **At the end of this period**, or **Now**. For **Now** you can also refund the unused part of the period | Yes, without the refund: `cancel` |
| **Change seats** | Sets the seat count, with the same preview as the API. Adding and removing take effect at once | Yes: `POST /v1/subscriptions/:id` |
| **Change price** | Moves the subscription to another recurring price in the same currency. It prorates by default | No |
| **Keep** | Undoes a cancellation that is still pending | No |

Which actions show depends on the subscription's state. For example, Keep only appears when it is set to end.

The customer page also has **Send portal link**. If the portal is off, Console shows a notice and a button to **Open Settings**; turn it on in Settings, **Payments** tab.

The **Customers** list has the tabs **All**, **Subscribed** and **One-time**. The **Checkout, Overview** page shows **Active subscriptions**.

## What the customer can do

The [customer portal](https://docs.easner.com/customer-portal.md) lets a customer manage their own subscriptions. Your server creates a portal link with `POST /v1/customer_portal/sessions` and redirects them. They can cancel, resume, switch plans, change the payment method and download receipts. You choose which of these they may do in Settings, **Payments** tab, under **Customer portal**:

| Setting | Notes |
| - | - |
| **Cancel subscriptions** | They keep access until the end of the period |
| **Switch plans** | Between the prices on the same product |
| **Change seats** | On a per-seat subscription: the seat count, with the charge or credit shown before they confirm |
| **Ask why they cancel** | Too expensive, Missing a feature, Switching, Taking a break, Something else |
| **Update payment methods** | |
| **See payments and download receipts** | |

Changes in the portal ask the customer for a six-digit code sent to their email.

## Test and live

Test subscriptions use the test card `4242 4242 4242 4242` and never charge. Test and live subscriptions, portals and webhooks are separate. A test key lists and changes only test subscriptions. See [Test and live](https://docs.easner.com/test-and-live.md).

> [card] [Customer portal](https://docs.easner.com/customer-portal.md)
>
> Let customers manage their own subscriptions.

> [card] [Checkout](https://docs.easner.com/checkout.md)
>
> The full session reference.


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