# Checkout fees

Add required charges and optional services to a market's checkout.

Checkout fees let an integration manage required charges and optional services for a market. Read requests require `read_markets`; changes require `write_markets`. Required fees apply automatically. Optional fees are offered for selection. Percentage fees use merchandise after product and order discounts, while fixed fees may apply once per order or once per merchandise unit. A fee's selected market tax class is applied after its amount is resolved.

## Endpoints

## List checkout fees

`GET /api/2025-01/markets/{marketId}/checkout-fees`

Fees are returned in checkout order together with the live authoring contract. Required fees are applied automatically. Optional fees are available for the customer or an admin to select. Percentage fees use merchandise after product and order discounts; fixed per-item fees multiply by the quantity of the items they apply to. Per-item and percentage fees show a calculation line under the fee name at checkout (for example `₹100.00 per item × 3` or `5% of ₹1,000.00`); its wording is the store's Storefront Messages text in the shopper's language. `checkout_fee_catalog.calculation_kinds` says which fees have one, and `calculation_defaults` gives that wording in each of the store's storefront languages, with the language's name in English as `label` and the platform label of a fee's text field as `text_prompt`. A fee may apply only to carts holding chosen products or products of chosen collections (`applies_to_options`, at most `max_targets_per_fee` targets), only from or below a discounted merchandise subtotal, and a percentage fee may be capped (`condition_types`).

Scope: `read_markets`

Response:

```json
{"success":true,"data":{"checkout_fees":[{"id":"6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d","market_id":"9a1f2c3d-4e5f-6789-abcd-ef0123456789","name":"Gift wrapping","description":"Wrap the order before dispatch","fee_type":"fixed","fee_type_label_key":"feeTypeFixed","value_input_kind":"amounts","fee_amounts":{"USD":"5.00"},"formatted_fee_amounts":{"USD":"$5.00"},"formatted_value":"$5.00","apply_per":"order","apply_per_label_key":"applyPerOrder","apply_per_description_key":"applyPerOrderDescription","tax_class_id":"4be5c5d1-0999-48ea-a2e0-f86703d99169","tax_code":"996812","is_enabled":true,"is_optional":true,"applies_to":"products","target_product_ids":["1042","1057"],"target_collection_ids":[],"targets":[{"type":"product","id":"1042","title":"Ceramic vase"},{"type":"product","id":"1057","title":"Glass candle holder"}],"min_subtotal_enabled":false,"min_subtotal_amounts":{},"max_subtotal_enabled":true,"max_subtotal_amounts":{"USD":"100.00"},"percent_cap_enabled":false,"percent_cap_amounts":{},"collect_text":true,"text_required":false,"text_max_length":150,"text_prompt":"Gift message","sort_order":2,"created_at":"2026-07-01T10:15:00+02:00","updated_at":"2026-07-21T14:30:00+02:00"}],"checkout_fee_catalog":{"fee_types":[{"value":"fixed","label_key":"feeTypeFixed","input_kind":"amounts","allowed_apply_units":["order","item"]},{"value":"percent","label_key":"feeTypePercent","input_kind":"percent","allowed_apply_units":["order"]}],"apply_units":[{"value":"order","label_key":"applyPerOrder","description_key":"applyPerOrderDescription"},{"value":"item","label_key":"applyPerItem","description_key":"applyPerItemDescription"}],"default_fee_type":"fixed","default_apply_unit":"order","default_enabled":true,"default_optional":false,"name_max_length":100,"description_max_length":500,"tax_code_max_length":20,"max_fees_per_market":5,"calculation_kinds":[{"fee_type":"fixed","apply_unit":"item","kind":"per_item"},{"fee_type":"percent","apply_unit":"order","kind":"percent"}],"calculation_defaults":[{"locale":"en","label":"English","default":{"per_item":"{{amount}} per item × {{quantity}}","percent":"{{rate}}% of {{base}}"},"text_prompt":"Message"}],"applies_to_options":[{"value":"all","label_key":"appliesToAll"},{"value":"products","label_key":"appliesToProducts","target_kind":"product"},{"value":"collections","label_key":"appliesToCollections","target_kind":"collection"}],"default_applies_to":"all","max_targets_per_fee":100,"condition_types":["min_subtotal","max_subtotal","percent_cap"],"text_max_length_limit":500,"default_text_max_length":150,"text_prompt_max_length":200}}}
```

## Get a checkout fee

`GET /api/2025-01/markets/{marketId}/checkout-fees/{feeId}`

Use the returned currency map and contract metadata when populating an edit form. Historical orders retain the fee snapshot recorded when they were placed.

Scope: `read_markets`

Response:

```json
{"success":true,"data":{"checkout_fee":{"id":"6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d","market_id":"9a1f2c3d-4e5f-6789-abcd-ef0123456789","name":"Gift wrapping","description":"Wrap the order before dispatch","fee_type":"fixed","fee_type_label_key":"feeTypeFixed","value_input_kind":"amounts","fee_amounts":{"USD":"5.00"},"formatted_fee_amounts":{"USD":"$5.00"},"formatted_value":"$5.00","apply_per":"order","apply_per_label_key":"applyPerOrder","apply_per_description_key":"applyPerOrderDescription","tax_class_id":"4be5c5d1-0999-48ea-a2e0-f86703d99169","tax_code":"996812","is_enabled":true,"is_optional":true,"applies_to":"products","target_product_ids":["1042","1057"],"target_collection_ids":[],"targets":[{"type":"product","id":"1042","title":"Ceramic vase"},{"type":"product","id":"1057","title":"Glass candle holder"}],"min_subtotal_enabled":false,"min_subtotal_amounts":{},"max_subtotal_enabled":true,"max_subtotal_amounts":{"USD":"100.00"},"percent_cap_enabled":false,"percent_cap_amounts":{},"collect_text":true,"text_required":false,"text_max_length":150,"text_prompt":"Gift message","sort_order":2,"created_at":"2026-07-01T10:15:00+02:00","updated_at":"2026-07-21T14:30:00+02:00"}}}
```

## Create a checkout fee

`POST /api/2025-01/markets/{marketId}/checkout-fees`

Fixed fees require an amount for every market currency and may apply once per order or once per merchandise unit. Percentage fees apply once per order to discounted merchandise. A selected tax class must belong to this market. Subtotal conditions and a percentage fee's cap need an amount for every market currency when enabled, like fixed amounts. An optional fee may ask the customer for text (`collect_text`). A successful create publishes `checkout_fees/create`.

Scope: `write_markets`

Response:

```json
{"success":true,"data":{"checkout_fee":{"id":"6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d","market_id":"9a1f2c3d-4e5f-6789-abcd-ef0123456789","name":"Gift wrapping","description":"Wrap the order before dispatch","fee_type":"fixed","fee_type_label_key":"feeTypeFixed","value_input_kind":"amounts","fee_amounts":{"USD":"5.00"},"formatted_fee_amounts":{"USD":"$5.00"},"formatted_value":"$5.00","apply_per":"order","apply_per_label_key":"applyPerOrder","apply_per_description_key":"applyPerOrderDescription","tax_class_id":"4be5c5d1-0999-48ea-a2e0-f86703d99169","tax_code":"996812","is_enabled":true,"is_optional":true,"applies_to":"products","target_product_ids":["1042","1057"],"target_collection_ids":[],"targets":[{"type":"product","id":"1042","title":"Ceramic vase"},{"type":"product","id":"1057","title":"Glass candle holder"}],"min_subtotal_enabled":false,"min_subtotal_amounts":{},"max_subtotal_enabled":true,"max_subtotal_amounts":{"USD":"100.00"},"percent_cap_enabled":false,"percent_cap_amounts":{},"collect_text":true,"text_required":false,"text_max_length":150,"text_prompt":"Gift message","sort_order":2,"created_at":"2026-07-01T10:15:00+02:00","updated_at":"2026-07-21T14:30:00+02:00"}},"code":"CHECKOUT_FEE_CREATED","message":"Checkout fee created."}
```

## Update a checkout fee

`PUT /api/2025-01/markets/{marketId}/checkout-fees/{feeId}`

Send the complete definition you want to keep: a condition, cap, targeting or text setting left out is turned off and its amounts, targets or prompts are deleted, and a `description`, `tax_class_id` or `tax_code` left out is cleared. An unchanged request leaves timestamps, audit history, and webhooks untouched. A successful change publishes `checkout_fees/update`.

Scope: `write_markets`

Response:

```json
{"success":true,"data":{"checkout_fee":{"id":"6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d","market_id":"9a1f2c3d-4e5f-6789-abcd-ef0123456789","name":"Gift wrapping","description":"Wrap the order before dispatch","fee_type":"fixed","fee_type_label_key":"feeTypeFixed","value_input_kind":"amounts","fee_amounts":{"USD":"5.00"},"formatted_fee_amounts":{"USD":"$5.00"},"formatted_value":"$5.00","apply_per":"order","apply_per_label_key":"applyPerOrder","apply_per_description_key":"applyPerOrderDescription","tax_class_id":"4be5c5d1-0999-48ea-a2e0-f86703d99169","tax_code":"996812","is_enabled":true,"is_optional":true,"applies_to":"products","target_product_ids":["1042","1057"],"target_collection_ids":[],"targets":[{"type":"product","id":"1042","title":"Ceramic vase"},{"type":"product","id":"1057","title":"Glass candle holder"}],"min_subtotal_enabled":false,"min_subtotal_amounts":{},"max_subtotal_enabled":true,"max_subtotal_amounts":{"USD":"100.00"},"percent_cap_enabled":false,"percent_cap_amounts":{},"collect_text":true,"text_required":false,"text_max_length":150,"text_prompt":"Gift message","sort_order":2,"created_at":"2026-07-01T10:15:00+02:00","updated_at":"2026-07-21T14:30:00+02:00"}},"code":"CHECKOUT_FEE_UPDATED","message":"Checkout fee updated."}
```

## Delete a checkout fee

`DELETE /api/2025-01/markets/{marketId}/checkout-fees/{feeId}`

Existing orders keep their saved fee and tax evidence. A successful deletion publishes `checkout_fees/delete` with the fee's last known identity.

Scope: `write_markets`

Response:

```json
{"success":true,"data":{"success":true},"code":"CHECKOUT_FEE_DELETED","message":"Checkout fee deleted."}
```

## Reorder checkout fees

`POST /api/2025-01/markets/{marketId}/checkout-fees/reorder`

Send every current fee id exactly once. An unchanged order is a no-op. A successful change publishes `checkout_fees/reorder` with the complete ordered id list.

Scope: `write_markets`

Response:

```json
{"success":true,"code":"CHECKOUT_FEES_REORDERED","message":"Checkout fees reordered."}
```

## Webhook events

Subscribe to these events when your app keeps a local copy of checkout fees. Create and update events contain the complete saved fee. Delete identifies the removed fee. Reorder contains the complete ordered id list. Requests that make no effective change do not publish an event.

## Checkout fee created

Event: `checkout_fees/create` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to receive a checkout fee after it is created in a market. Money maps contain exact decimal strings keyed by currency code, using currency amount precision (for example KWD 1.234, KRW 1234, USD 12.34). They never use General display separators or symbols.

```json
{
  "checkout_fee": {
    "applies_to": "products",
    "apply_per": "order",
    "collect_text": true,
    "created_at": "2026-07-01T10:15:00-04:00",
    "description": "Wrap the order before dispatch",
    "fee_amounts": {
      "USD": "5.00"
    },
    "fee_type": "fixed",
    "id": "6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d",
    "is_enabled": true,
    "is_optional": true,
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "max_subtotal_amounts": {
      "USD": "100.00"
    },
    "max_subtotal_enabled": true,
    "min_subtotal_amounts": {},
    "min_subtotal_enabled": false,
    "name": "Gift wrapping",
    "percent_cap_amounts": {},
    "percent_cap_enabled": false,
    "percent_value": null,
    "sort_order": 2,
    "target_collection_ids": [],
    "target_product_ids": [
      "1042",
      "1057"
    ],
    "targets": [
      {
        "id": "1042",
        "title": "Ceramic vase",
        "type": "product"
      },
      {
        "id": "1057",
        "title": "Glass candle holder",
        "type": "product"
      }
    ],
    "tax_class_id": "4be5c5d1-0999-48ea-a2e0-f86703d99169",
    "tax_code": "996812",
    "text_max_length": 150,
    "text_prompt": "Gift message",
    "text_required": false,
    "updated_at": "2026-07-21T14:30:00-04:00"
  }
}
```

## Checkout fee updated

Event: `checkout_fees/update` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to receive the current checkout fee after its amount, application, tax treatment or availability changes. A new position sends `checkout_fees/reorder` instead. Money maps contain exact decimal strings keyed by currency code, using currency amount precision (for example KWD 1.234, KRW 1234, USD 12.34). They never use General display separators or symbols.

```json
{
  "checkout_fee": {
    "applies_to": "products",
    "apply_per": "order",
    "collect_text": true,
    "created_at": "2026-07-01T10:15:00-04:00",
    "description": "Wrap the order before dispatch",
    "fee_amounts": {
      "USD": "5.00"
    },
    "fee_type": "fixed",
    "id": "6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d",
    "is_enabled": true,
    "is_optional": true,
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "max_subtotal_amounts": {
      "USD": "100.00"
    },
    "max_subtotal_enabled": true,
    "min_subtotal_amounts": {},
    "min_subtotal_enabled": false,
    "name": "Gift wrapping",
    "percent_cap_amounts": {},
    "percent_cap_enabled": false,
    "percent_value": null,
    "sort_order": 2,
    "target_collection_ids": [],
    "target_product_ids": [
      "1042",
      "1057"
    ],
    "targets": [
      {
        "id": "1042",
        "title": "Ceramic vase",
        "type": "product"
      },
      {
        "id": "1057",
        "title": "Glass candle holder",
        "type": "product"
      }
    ],
    "tax_class_id": "4be5c5d1-0999-48ea-a2e0-f86703d99169",
    "tax_code": "996812",
    "text_max_length": 150,
    "text_prompt": "Gift message",
    "text_required": false,
    "updated_at": "2026-07-21T14:30:00-04:00"
  }
}
```

## Checkout fee deleted

Event: `checkout_fees/delete` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to remove a deleted checkout fee from your integration. The payload keeps its id, market id, and last known name.

```json
{
  "checkout_fee": {
    "id": "6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "name": "Gift wrapping"
  }
}
```

## Checkout fees reordered

Event: `checkout_fees/reorder` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to receive the complete checkout fee order after fees are rearranged in a market.

```json
{
  "fee_ids": [
    "2a7f1c3d-4e5b-4890-a6c8-1d3e5f7a9b0c",
    "6a9d2e4f-1b3c-4785-9a0d-2e4f6a8b1c3d"
  ],
  "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789"
}
```

