---
title: "Names a coupon on a cart, or takes it off with null."
---

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

Path: Sherpo customer API › checkout

`PUT /v1/stores/{store}/checkouts/{checkout}/coupon`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `checkout:write`

## Path parameters

- `store` (`applyCoupon.path.store`; string, required) — A hostname of the store.
- `checkout` (`applyCoupon.path.checkout`; string, required)
  - minLength 1

## Request body

_Required._

- `code` (`applyCoupon.code`; any of, required) — A discount's code, or its id as an affiliate link carries it.
  - any of: `string`, `null`

## Example request

```json
{
  "code": "string"
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://api.sherpo.io/customer/v1/stores/<store>/checkouts/<checkout>/coupon' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/customer/v1/stores/<store>/checkouts/<checkout>/coupon';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({code: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/customer/v1/stores/<store>/checkouts/<checkout>/coupon"

payload = { "code": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Names a coupon on a cart, or takes it off with null.

#### Example

```json
{
  "status": "string",
  "order": {
    "id": "string",
    "number": 0
  },
  "under_minimum": {
    "processor": "stripe",
    "amount": 0,
    "minimum": 0
  },
  "refund_consent": "string",
  "card_required": {
    "reason": "string"
  },
  "items": [
    {
      "product": {
        "id": "string",
        "slug": "string",
        "path": "string",
        "url": "string",
        "title": "string",
        "category": "string",
        "deleted": true
      },
      "autorenew": true,
      "first_charge_at": "string",
      "refund_policy": "string",
      "refund_until": "string",
      "id": "string",
      "product_id": "string",
      "price_id": "string",
      "quantity": 0,
      "amount": 0,
      "discount": 0,
      "discount_id": "string",
      "total": 0,
      "mode": "string",
      "display_name": "string",
      "message": "string",
      "guests": [
        {
          "email": "string",
          "name": "string"
        }
      ]
    }
  ],
  "totals": {
    "amount": 0,
    "discount": 0,
    "total": 0
  },
  "id": "string",
  "currency": "string",
  "exponent": 0,
  "coupon": "string",
  "refund_waiver": {
    "policy": "string",
    "accepted_at": "string"
  },
  "expires_at": "string",
  "created_at": "string",
  "updated_at": "string"
}
```

- `status` (`applyCoupon.response.200.status`; string, required)
- `order` (`applyCoupon.response.200.order`; any of, required)
  - any of: `object`, `null`
- `under_minimum` (`applyCoupon.response.200.under_minimum`; any of, required)
  - any of: `object`, `null`
- `refund_consent` (`applyCoupon.response.200.refund_consent`; any of, required)
  - any of: `string`, `null`
- `card_required` (`applyCoupon.response.200.card_required`; any of, required)
  - any of: `object`, `null`
- `items` (`applyCoupon.response.200.items`; array<object>, required)
  - `product` (`applyCoupon.response.200.items.product`; any of, required)
    - any of: `object`, `null`
  - `autorenew` (`applyCoupon.response.200.items.autorenew`; any of, required)
    - any of: `boolean`, `null`
  - `first_charge_at` (`applyCoupon.response.200.items.first_charge_at`; any of, required)
    - any of: `string`, `null`
  - `refund_policy` (`applyCoupon.response.200.items.refund_policy`; any of, required)
    - any of: `string`, `null`
  - `refund_until` (`applyCoupon.response.200.items.refund_until`; any of, required)
    - any of: `string`, `null`
  - `id` (`applyCoupon.response.200.items.id`; string, required)
  - `product_id` (`applyCoupon.response.200.items.product_id`; string, required)
  - `price_id` (`applyCoupon.response.200.items.price_id`; string, required)
  - `quantity` (`applyCoupon.response.200.items.quantity`; number, required)
  - `amount` (`applyCoupon.response.200.items.amount`; number, required)
  - `discount` (`applyCoupon.response.200.items.discount`; number, required)
  - `discount_id` (`applyCoupon.response.200.items.discount_id`; any of, required)
    - any of: `string`, `null`
  - `total` (`applyCoupon.response.200.items.total`; number, required)
  - `mode` (`applyCoupon.response.200.items.mode`; string, required)
  - `display_name` (`applyCoupon.response.200.items.display_name`; any of, required)
    - any of: `string`, `null`
  - `message` (`applyCoupon.response.200.items.message`; any of, required)
    - any of: `string`, `null`
  - `guests` (`applyCoupon.response.200.items.guests`; array<object>, required)
    - `email` (`applyCoupon.response.200.items.guests.email`; string, required)
    - `name` (`applyCoupon.response.200.items.guests.name`; any of, required)
      - any of: `string`, `null`
- `totals` (`applyCoupon.response.200.totals`; object, required)
  - `amount` (`applyCoupon.response.200.totals.amount`; number, required)
  - `discount` (`applyCoupon.response.200.totals.discount`; number, required)
  - `total` (`applyCoupon.response.200.totals.total`; number, required)
- `id` (`applyCoupon.response.200.id`; string, required)
- `currency` (`applyCoupon.response.200.currency`; string, required)
- `exponent` (`applyCoupon.response.200.exponent`; any of, required)
  - any of: `number`, `null`
- `coupon` (`applyCoupon.response.200.coupon`; any of, required)
  - any of: `string`, `null`
- `refund_waiver` (`applyCoupon.response.200.refund_waiver`; any of, required)
  - any of: `object`, `null`
- `expires_at` (`applyCoupon.response.200.expires_at`; any of, required)
  - any of: `string`, `null`
- `created_at` (`applyCoupon.response.200.created_at`; any of, required)
  - any of: `string`, `null`
- `updated_at` (`applyCoupon.response.200.updated_at`; any of, required)
  - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/customer/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`applyCoupon.response.default.type`; string, required)
  - format `uri`
- `title` (`applyCoupon.response.default.title`; string, required)
- `status` (`applyCoupon.response.default.status`; integer, required)
- `detail` (`applyCoupon.response.default.detail`; string, required)
- `code` (`applyCoupon.response.default.code`; string, optional)
- `context` (`applyCoupon.response.default.context`; object, optional)
- `reached_core` (`applyCoupon.response.default.reached_core`; boolean, optional)
- `core_answer` (`applyCoupon.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/customer-api/reference/apply-coupon/index.md
