> ## 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.

# Products and prices

> The catalog Checkout sessions sell from. Create and change products and prices with the API or Console.

A product is something you sell. A price is an amount, a currency and, for recurring prices, how often it bills. One product can have several prices, for example a monthly and a yearly plan. A Checkout session sells a price from this catalog, so you set a price once and reuse it. Discount codes are on [Discounts and promotion codes](https://docs.easner.com/checkout-discounts.md).

> [!NOTE]
>
> **API and Console.** The `/v1/products` and `/v1/prices` routes read and change the catalog with a secret key that has the `checkout` scope. Console does the same under **Checkout**, **Products**, and follows the Test / Live switch. Both work on the same catalog. Products and prices made with a test key are test objects: a live key does not see them, and the other way round. Payment links use the live catalog from Banking, **Collections**, **Links**.

## Routes

| Method | Path | Scope | Id |
| - | - | - | - |
| `GET` | `/v1/products` | `checkout` | UUID |
| `POST` | `/v1/products` | `checkout` | UUID |
| `GET` | `/v1/products/:id` | `checkout` | UUID |
| `POST` | `/v1/products/:id` | `checkout` | UUID |
| `GET` | `/v1/prices` | `checkout` | UUID |
| `POST` | `/v1/prices` | `checkout` | UUID |
| `GET` | `/v1/prices/:id` | `checkout` | UUID |
| `POST` | `/v1/prices/:id` | `checkout` | UUID |

Products and prices have no `plink_`-style prefix. Their ids are UUIDs, the same ids Checkout → Products shows and the same ids `line_items[].price` takes on a session. There is no `DELETE`: archive with `active: false`.

## Products

Every field is on [Create a product](https://docs.easner.com/api-reference/products/create-a-product.md) and [Retrieve a product](https://docs.easner.com/api-reference/products/retrieve-a-product.md). Those pages are the contract. `name` is required, up to 200 characters. `description` is up to 1,000 characters. `active: false` creates it archived.

`POST /v1/products/:id` changes `name`, `description` and `active`. `active: false` archives the product and `active: true` restores it. An archived product cannot take new prices, but its existing prices still work on the links that use them.

`GET /v1/products` lists this mode's products, newest first. Filter with `active=true` or `active=false`. `GET /v1/products/:id` reads one. Products do not carry their prices: list them with `GET /v1/prices?product=<id>`.

## Prices

Every field is on [Create a price](https://docs.easner.com/api-reference/prices/create-a-price.md) and [Retrieve a price](https://docs.easner.com/api-reference/prices/retrieve-a-price.md). Those pages are the contract. `product` is required and must not be archived. `unit_amount` is **whole cents**, above zero: `1500` is \$15.00. A fraction such as `12.5` is refused. Leave `interval` out, or send `none`, for a one-time price. Otherwise `day`, `week`, `month` or `year`. `per_seat: true` makes `unit_amount` the price for each seat. See [Per-seat pricing](#per-seat-pricing). Send `tiers_mode` and `tiers` instead of `unit_amount` for a price that falls as the team grows. See [Tiered prices](#tiered-prices).

A price is immutable. `POST /v1/prices/:id` takes `active` only: `false` archives the price and `true` restores it. Changing its `unit_amount`, `currency`, `interval`, `interval_count`, `trial_days`, `per_seat`, `min_quantity`, `max_quantity`, `tiers`, `tiers_mode`, `mode` or `product` is `409` `invalid_request`, and `error.fields` names the field. To change an amount, archive the price and create a new one. A payment link that already uses a price keeps the amount it was shown.

`GET /v1/prices` lists this mode's prices, newest first. Filters: `product` (a product id), and `active`. `GET /v1/prices/:id` reads one.

`unit_amount` is always cents. On a tiered price it is the first band's price. `interval`, `interval_count`, `trial_days` and `min_quantity` are `null` on a one-time price, and `per_seat` is `false`. `mode` is `one_time` or `subscription`.

### Per-seat pricing

Set `per_seat: true` on a recurring price to charge per user. A Checkout session or payment link that uses it sets the seat count as the line's `quantity`. After the subscription starts, you change the seats with [`POST /v1/subscriptions/:id`](https://docs.easner.com/subscriptions#change-seats-or-price), and your customer can change them in the portal when you allow it (Settings, **Payments** tab, **Customer portal**, **Change seats**). `min_quantity` is the floor for both: a change below it is `400`.

A price with `per_seat: false` is a flat price. Its subscription has one seat, and the portal does not offer Change seats.

### Tiered prices

A tiered price lowers the price per seat as the team grows. Task Harbor's bands, for example: $12 for up to 10 seats, $10 for 11 to 25, and \$8 above that.

```bash theme={null}
curl https://api.easner.com/v1/prices \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "product": "<product id>",
    "interval": "month",
    "per_seat": true,
    "min_quantity": 1,
    "max_quantity": 50,
    "tiers_mode": "graduated",
    "tiers": [
      { "up_to": 10, "unit_amount": 1200 },
      { "up_to": 25, "unit_amount": 1000 },
      { "up_to": null, "unit_amount": 800 }
    ]
  }'
```

`tiers` takes 2 to 8 bands, in order. Each band's `up_to` is the last seat in it, a whole number above the band before. The last band has `up_to: null`. Every `unit_amount` is whole cents above zero. Leave `unit_amount` out. `tiers` needs `per_seat: true`.

`tiers_mode` decides how the bands add up:

| `tiers_mode` | Rule | 11 seats on the bands above | 26 seats |
| - | - | - | - |
| `graduated` | Each seat is billed at the price of the band it falls in | 10 × $12 + 1 × $10 = \$130.00 | $120 + $150 + $8 = $278.00 |
| `volume` | Every seat is billed at the price of the band the whole team lands in | 11 × $10 = $110.00 | 26 × $8 = $208.00 |

With `volume`, a bigger team can cost less than a smaller one (11 seats cost less than 10). With `graduated` the total only ever rises as seats are added. Pick the one that matches what you tell your customers.

The checkout, the seat-change preview and the portal all work out the total from the bands, so you never calculate it and you do not send extra line items. The subscription still has one `quantity`. `POST /v1/checkout/sessions` reports a tiered line with `amount_cents` as the total for the seats, `unit_amount_cents` as the average per seat, and `tier_breakdown` as the bands that quantity uses. Each row is `{ "quantity", "unit_amount", "amount" }` in cents. Graduated prices get one row per band that has seats in it. Volume prices get one row, every seat at the band the whole quantity lands in. The row amounts sum to `amount_cents`. The same `tier_breakdown` is on the subscription. A trial still has `amount_due_today` of `0`; the rows are the amount that starts when the trial ends.

### Set up a tiered subscription

Create the catalog once. Every later checkout sends the price id and a quantity. Console, Checkout, Products can add these bands on **Add a price**, and so can the API. Copy the id from that page.

1. `POST /v1/products` once. One product holds every interval.
2. `POST /v1/prices` once per interval, using the body above. A yearly price is a second call on the same product with `"interval": "year"` and that interval's own `unit_amount`s. Add `trial_days` on the price when the subscription starts with a trial. Run `POST /v1/products` once: a second product call creates another product. A price cannot be edited. Archive it and create a new one.
3. Store each price id with the secret key that created it. A session sends one line, and the quantity is the seat count:

```json theme={null}
{
  "mode": "subscription",
  "line_items": [{ "price": "<price uuid>", "quantity": 11 }],
  "payment_method_collection": "if_required",
  "trial_end_behavior": "pause",
  "success_url": "https://yoursite.com/welcome?session_id={CHECKOUT_SESSION_ID}",
  "cancel_url": "https://yoursite.com/pricing"
}
```

`if_required` with `trial_end_behavior` needs a trial on the price. See [Start a trial without a card](https://docs.easner.com/subscriptions.md#start-a-trial-without-a-card). Omit both when the customer pays on the first day.

4. A price id works only in the mode of the key that created it. Create the prices again with the live key before a live session.
5. `success_url`, `cancel_url`, and the browser `Origin` must be on a website you added in Console, Checkout, your site, Settings. Otherwise the session is `400` `origin_not_allowed`. In test mode, `localhost` is allowed without being listed. See [Checkout](https://docs.easner.com/checkout.md#create-a-session).

### Limits on a recurring price

| Rule | Limit |
| - | - |
| Billing interval | Day, week, month or year |
| Custom interval count | Up to 365 days, 52 weeks, 12 months or 1 year, so billing is never less often than once a year |
| Free trial | 0 to 730 days |
| Amount | Greater than zero |

## Use a price

A Checkout session takes a catalog price on a line:

```json theme={null}
{
  "mode": "payment",
  "line_items": [{ "price": "<price uuid>", "quantity": 1 }],
  "success_url": "https://yoursite.com/thanks",
  "cancel_url": "https://yoursite.com/cart"
}
```

`line_items[].price` is a price id. It supplies the name, amount and currency. A recurring price makes the session a subscription. The full list of line item fields is on [Checkout](https://docs.easner.com/checkout.md#create-a-session).

> [!NOTE]
>
> A price id is a catalog id. It works with the mode it was made in: a session in test mode needs a test price.

## Console

In Console, **Checkout**, **Products**. The page follows the Test / Live switch. A product made with the API in that mode is in this list.

### Add a product

| Field | Notes |
| - | - |
| **Product name** | Required, for example "House blend, 1 kg" |
| **Description** | Optional |
| **Price** | Optional. Amount and currency. **One-time**, **Monthly** or **Yearly** |

Select **Add product**. Each product shows its prices. **Archive** and restore a product with the icon beside its name. An archived product shows an Archived badge and cannot take new prices. **Subscribers** lists who is on that product in this mode, and opens the payer.

### Add and archive prices

Select **Add a price** under a product. Choose **One-time**, **Monthly** or **Yearly**, a currency, and an optional trial in days. A monthly or yearly price can be **per seat**, with a minimum and a maximum, and the price per seat can fall as the team grows. The same fields are on [Tiered prices](#tiered-prices).

Each price shows its id under the amount, with a copy button. That id is `line_items[].price`. **Archive** next to a price stops it being used for new checkouts, and **Restore** brings it back.

Banking, **Collections**, **Links**, **Products** is the live catalog for payment links. It does not follow the Test / Live switch.

> [!WARNING]
>
> A price a payment link uses cannot be edited, because the amount is what customers were shown. Archive it, and add a new one.

Product details such as an image address and a tax code are checked when present. Names are up to 200 characters and descriptions up to 1,000.

## Webhooks

Creating, changing or archiving a product or price does not send a merchant webhook event. Nothing about the catalog is in [Webhook events](https://docs.easner.com/webhook-events.md).

## Errors

| `code` | HTTP | When |
| - | - | - |
| `invalid_request` | 400 | A field is missing or wrong. `error.fields` names it: the name, the cents amount, the interval, the trial, the currency, or the product id |
| `invalid_request` | 409 | A price's amount, currency or interval changes, or a price is created on an archived product. `error.fields` names the field |
| `not_found` | 404 | The id is not in this mode for your business |
| `key_forbidden` | 403 | The key does not have the `checkout` scope |

See [Errors](https://docs.easner.com/errors.md#products-prices-and-promotion-codes) for the full list.

> [card] [Discounts and promotion codes](https://docs.easner.com/checkout-discounts.md)
>
> Discount codes customers type at checkout.


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