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

# Discounts and promotion codes

> Typed codes at checkout and per-customer discounts by email.

Checkout supports two discount types: a **promotion code** anyone can type, and a **customer discount** tied to one email. They do not stack on one session.

## Promotion codes

A promotion code is a discount a customer types at checkout. To give one person a discount that applies without typing anything, use a [customer discount](#customer-discounts). A code applies on every Checkout session in the mode it was created in: the API, a payment link, the hosted page and the embed. It is not limited to one product. An invoice does not take a code. Set `allow_promotion_codes` to `false` on a session to hide the field. See [Checkout](https://docs.easner.com/checkout.md).

> [!NOTE]
>
> **API and Console.** The `/v1/promotion_codes` routes create, list, read and switch off codes with a secret key that has the `checkout` scope. Console does the same under **Checkout**, **Promotion codes**, and follows the Test / Live switch. A code is made in one mode: a test key makes test codes, and a live key does not see them. Payment links use the live codes from Banking, **Collections**, **Links**.

## Routes

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

There is no `DELETE`. Switch a code off with `active: false`, and it stops giving the discount.

## Create a code

Every field is on [Create a promotion code](https://docs.easner.com/api-reference/promotion-codes/create-a-promotion-code.md) and [Retrieve a promotion code](https://docs.easner.com/api-reference/promotion-codes/retrieve-a-promotion-code.md). Those pages are the contract.

`code` is 3 to 40 letters, numbers, `-` or `_`, saved in uppercase, so `save20` is `SAVE20`. Send `percent_off` or `amount_off`, not both. `amount_off` is whole cents and needs `currency`. `duration` is `once` (the first payment, the default), `forever`, or `repeating` with `duration_in_months` from 1 to 36. The response is `201`. `amount_off` is in cents. `active` is `true` only while the code is on and not archived. `times_redeemed` counts the payments that used it.

Codes are unique per mode among the ones not archived. A second `SAVE20` in the same mode is `409` `invalid_request` with `error.fields` naming `code`. The same code in the other mode is fine.

## Switch a code on or off

`POST /v1/promotion_codes/:id` takes `active` only. `false` turns the code off, and it stops working at once: a checkout started after that cannot use it. `true` turns it back on.

A code is immutable. Its discount, currency, duration, months, limit and end date are fixed, so changing any of them is `409` `invalid_request`, with `error.fields` naming the field. Make a new code instead. An archived code cannot change either.

Turning a code off is applied at the payment provider too, where the code was already used for a checkout. If the provider refuses the change, nothing changes and the call answers `503` `api_error`. Retry it.

`GET /v1/promotion_codes` lists this mode's codes, newest first, with `active=true` or `active=false` as a filter. `GET /v1/promotion_codes/:id` reads one.

## Where a code shows

On the hosted page, the overlay and the inline form, a customer sees **Add promotion code** whenever this mode has a code they can use. A valid code shows the amount off with a remove button. An invalid code reads "That code isn't valid." An amount off works on checkouts in that currency. A percent off works on every currency.

## Console

In Console, **Checkout**, **Promotion codes**. The page follows the Test / Live switch, so a test code is not in the live list. A code's **Code** is 3 to 40 characters, uppercase. **Discount** is **Percent off** (1 to 100) or **Amount off** (with a currency). **Applies to** is **First payment**, **A number of months** (1 to 36) or **Every payment**. **Times it can be used** and **Expires** are optional.

Each code in the list shows how many times it was used, and the limit if set. A switch turns the code on or off, and the **Archive** icon removes it from use. Archiving is Console only: a code archived in Console answers as `active: false` and `archived: true` on the API.

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

## Webhooks

Creating or switching off a promotion code does not send a merchant webhook event.

## Errors

| `code` | HTTP | When |
| - | - | - |
| `invalid_request` | 400 | A field is missing or wrong, such as a bad code, a percentage out of range, or `amount_off` with no `currency`. `error.fields` names it |
| `invalid_request` | 409 | A duplicate code in this mode, or a change to an immutable field, or a change to an archived code. `error.fields` names the field |
| `not_found` | 404 | The id is not in this mode for your business |
| `api_error` | 503 | The payment provider could not change the code. Nothing changed. Retry |

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

## Customer discounts

A customer discount belongs to one person. You grant it to an email address. When that person checks out with that email, the discount applies and they see it. Nobody else can use it.

Use a customer discount when the price is for someone in particular: a discount for a team, a veteran, a member of a community, or an agreed rate for one account. For a code anyone can type, use a [promotion code](#promotion-codes).

> [!NOTE]
>
> **API and Console.** `/v1/discounts` grants, lists and switches off customer discounts with a secret key that has the `checkout` scope. Console does the same on a customer's page, under **Discounts**. A discount is made in one mode: a test key makes test discounts.

### How it applies

* A checkout session created with a `customer_email` that has an active discount applies it. The payer sees "Your discount is applied" and the amount off, with no code to type.
* **Send `customer_email` when you create the session.** A discount can only apply to a session that knows the customer's email. In a signed-in product you already have it, so pass it every time. A payment link, or a session created without an email, takes no customer discount: the payer pays the listed price, and can still use a public [promotion code](#promotion-codes).
* It applies to one-time payments and to subscriptions. A subscription with a `repeating` or `forever` discount keeps the discount on each renewal, for as long as the duration lasts.
* A discount is applied by Easner as a coupon on the payment provider's side. A payer cannot type it, and it never appears as a code.
* A session that applies a customer discount does not show the **Add promotion code** field. Public promotion codes do not stack on a customer discount. This is set by the payment provider, which does not allow both on one session.
* A discount is matched on the email, without regard to capitals. `Ada@Example.com` and `ada@example.com` are the same person.

### Routes

| Method | Path | Scope | What it does |
| - | - | - | - |
| `POST` | `/v1/discounts` | `checkout` | Grant a discount to an email |
| `GET` | `/v1/discounts` | `checkout.read` | List discounts, newest first |
| `GET` | `/v1/discounts/:id` | `checkout.read` | Read one discount |
| `POST` | `/v1/discounts/:id` | `checkout` | Switch it on or off with `active` |

There is no `DELETE`. To stop a discount, send `active: false`. It stops applying at once, to new checkouts and to renewals that have not yet been charged.

### Grant a discount

`POST /v1/discounts` takes:

| Field | Type | Notes |
| - | - | - |
| `customer_email` | string | Required. The email the discount is for |
| `percent_off` | number | From above 0 to 100, to two decimal places. Send this **or** `amount_off` |
| `amount_off` | integer | A fixed discount in **whole cents**, above zero. Needs `currency`. Send this **or** `percent_off` |
| `currency` | string | Three letters. Required with `amount_off`. It must match the price's currency |
| `duration` | string | `once` (the first payment), `repeating` (for `duration_in_months` months), or `forever` (every payment). Default `once` |
| `duration_in_months` | integer | 1 to 36. Required with `duration: repeating`, and refused otherwise |
| `active` | boolean | Default `true` |

```bash theme={null}
curl https://api.easner.com/v1/discounts \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: discount-ada-2026-10" \
  -d '{
    "customer_email": "ada@example.com",
    "percent_off": 20,
    "duration": "repeating",
    "duration_in_months": 3
  }'
```

The response is `201`:

```json theme={null}
{
  "object": "discount",
  "id": "5c0e7a1b-8d2f-4e6a-9b31-7f4d2c9e0a18",
  "livemode": false,
  "customer_email": "ada@example.com",
  "percent_off": 20,
  "amount_off": null,
  "currency": null,
  "duration": "repeating",
  "duration_in_months": 3,
  "description": "20% off for 3 months",
  "active": true,
  "created": "2026-10-10T09:00:00.000Z"
}
```

Honours `Idempotency-Key`. A retry with the same key and body answers `200` with the same discount.

**One active discount per email.** A second active discount for the same email in the same mode is `409`. Switch the first one off, then grant the new one. This keeps the price for each person easy to explain.

**Easner emails the customer** when a discount is granted, from your business name: that the discount is on, what it changes, and for how long. The email never contains a code.

**The amount and the duration are fixed.** To change them, switch the discount off and grant a new one.

### List and read

```bash theme={null}
curl "https://api.easner.com/v1/discounts?customer_email=ada@example.com&active=true" \
  -H "Authorization: Bearer $EASNER_SECRET_KEY"
```

Filters: `customer_email` and `active`. Lists take `limit` and `starting_after`. See [v1 reference](https://docs.easner.com/reference.md#lists).

### Switch a discount off

```bash theme={null}
curl https://api.easner.com/v1/discounts/5c0e7a1b-8d2f-4e6a-9b31-7f4d2c9e0a18 \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "active": false }'
```

`active: false` stops the discount at once. A subscription that already has it loses it at its next renewal. Charges already made are not changed. `active: true` switches it back on, if no other discount is active for the same email.

### Processing fee

A discount cannot be combined with a processing fee that your customers pay. If you pass the fee to customers (Settings, **Payments** tab, **Processing fees**), `POST /v1/discounts` answers `409` with the message "Discounts can't be combined with a processing fee paid by customers." Change who pays the fee first.

### Webhooks

Granting, listing and switching off a discount does not send a merchant webhook event. A subscription's renewal still sends `subscription.updated`, with the amount that was charged.

### Console

In Console, open **Checkout**, **Customers**, then the customer. The **Discounts** section lists each discount with its value, its duration and whether it is active. **Grant discount** asks for the discount, then shows the new monthly amount before it is saved. **Revoke** asks first and says what the next invoice becomes. Past invoices do not change.

### Errors

| `code` | HTTP | When |
| - | - | - |
| `invalid_request` | 400 | A field is missing or wrong, such as a bad email, a percentage out of range, `amount_off` with no `currency`, or `duration_in_months` without `repeating`. `error.fields` names it |
| `invalid_request` | 409 | The email already has an active discount, or the fee is paid by customers. The message says which |
| `not_found` | 404 | The id is not in this mode for your business |
| `not_available` | 503 | The payment provider could not create the discount. Nothing changed. Retry with the same `Idempotency-Key` |

See [Errors](https://docs.easner.com/errors.md#seats-and-discounts).


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