﻿# Receipt defaults

Receipt defaults are the merchant and product details that digital receipts use when your order data does not include them. We build Consumer Clarity (Mastercard, through Ethoca) and Order Insight (Visa, through Verifi) receipts from your order data, and fill the gaps from the default merchant and the default product that are linked to the enrolment. Order data takes precedence: a merchant field in the order replaces the same default field, and the order items replace the default product. Use this API to create and maintain the defaults.

:::note
Receipt defaults have the same access as Consumer Clarity and Order Insight enrolments, which we enable per account. Contact support to enable them. For an organisation without this access, the endpoints return `404 Not found`. A list leaves out the records of organisations without access, and returns `404 Not found` when none of the organisations that the key can use has access.
:::

If the merchant and product details change from order to order, send them with each order instead. See [Product and merchant information](/developer/api-documentation/orders#product-and-merchant-information) in the Orders API. A Consumer Clarity receipt from a [real-time endpoint](/developer/real-time-endpoints) uses only the order that your endpoint returns, and no defaults.

**Base URL:** `https://api.chargebackstop.com/v1/receipt-defaults/`\
**Authentication:** Bearer token via API key.

Required abilities:

* `receipt_defaults:read` for GET endpoints
* `receipt_defaults:write` for POST, PATCH, and DELETE endpoints

If a key returns `403 Forbidden` for these endpoints, contact support to add the abilities to it.

Access scope model:

| API key                     | Organisations                       |
| --------------------------- | ----------------------------------- |
| Organisation key            | Its own organisation                |
| Non-admin partner-group key | Organisations assigned to its group |
| Admin partner-group key     | All organisations of the partner    |

* When you create a logo upload, a default merchant, or a default product, a partner-group key must send `organisation_id`. An organisation key can leave it out. If an organisation key sends it, the value must be its own organisation. Any other value returns `404 Not found`.
* A record in an organisation that the key cannot access returns `404 Not found`. A list filtered by such an organisation is empty.

Conventions:

* Lists use `limit` (default `100`) and `offset` (default `0`), and return `{ "items": [...], "count": n }`, where `count` is the number of records that match the filters before pagination. Lists show the oldest record first.
* Timestamps are ISO 8601 in UTC.
* A text field must not be blank. A value of only spaces returns `422`.
* Treat all IDs as opaque strings.

Rate limits:

* The logo upload endpoint allows 10 requests per minute.
* Each of the other endpoints allows 100 requests per minute.
* We count requests for each organisation or partner group that owns the API key, not for each key. Each endpoint has its own count.
* When you go over the limit, the response is `429 Too Many Requests` with the code `RATE_LIMITED`. See [Example 20](#example-20-response-429-rate-limited).

## Set up receipt defaults

1. Upload the merchant logo with [`POST /v1/receipt-defaults/logos`](#post-v1-receipt-defaults-logos-upload-a-logo). The response gives an upload ID.
2. Create the default merchant with [`POST /v1/receipt-defaults/merchants`](#post-v1-receipt-defaults-merchants-create-a-default-merchant). Send the upload ID as `merchant_logo_upload_id`. Every default merchant needs a logo.
3. Create the default product with [`POST /v1/receipt-defaults/products`](#post-v1-receipt-defaults-products-create-a-default-product). A product has no logo, so you can create it at any time.
4. In the organisation's dashboard, go to **Settings > Deflection**. Edit the default merchant and the default product, and select the enrolments that use them in the **Enrolments** field. If **Deflection** does not show in **Settings**, contact support.

Each enrolment can use one default merchant and one default product. You can link one default merchant or product to several enrolments. To move an enrolment to a different default, first remove it from its current one.

You link defaults to enrolments only in the dashboard. The API does not show or change these links.

Consumer Clarity receipts show the merchant logo. Order Insight receipts do not show a logo.

***

## POST /v1/receipt-defaults/logos - Upload a logo

Uploads a PNG logo for default merchants. The response gives the upload ID to send as `merchant_logo_upload_id`.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### Request body

Send `multipart/form-data` with these parts:

| Part              | Type   | Required          | Description                                                     |
| ----------------- | ------ | ----------------- | --------------------------------------------------------------- |
| `file`            | file   | Yes               | The logo                                                        |
| `organisation_id` | string | Partner keys only | Organisation that owns the upload. Organisation keys can leave it out. |

### Logo rules

1. The file must be 1 MB (1,048,576 bytes) or smaller.
2. The file must be a valid PNG.
3. The image must be at most 320 pixels wide and at most 320 pixels high.
4. The PNG must not be animated.

We check the rules in this order. The error response gives the code of the first rule that the file does not meet.

### Important behaviour

* We store a re-encoded copy of the image without its metadata. `width`, `height`, and `size_bytes` describe the stored copy, so `size_bytes` can be different from the size of your file.
* An upload belongs to one organisation. You can use it for any number of default merchants in that organisation.
* Uploads are not public. The image is available only at the `merchant_logo_url` of a merchant that uses it. See [The logo URL](#the-logo-url).
* There is no endpoint to get, list, or delete a logo upload.

### Error codes

| Status | Code                        | When                                                         | Message                                         |
| ------ | --------------------------- | ------------------------------------------------------------ | ----------------------------------------------- |
| 422    | `LOGO_TOO_LARGE`            | The file is larger than 1 MB                                 | `The logo must be 1 MB or smaller.`             |
| 422    | `LOGO_NOT_PNG`              | The file is not a valid PNG                                  | `The logo must be a PNG file.`                  |
| 422    | `LOGO_DIMENSIONS_TOO_LARGE` | The image is wider or higher than 320 pixels                 | `The logo must be at most 320 × 320 pixels.`    |
| 422    | `LOGO_ANIMATED`             | The PNG is animated                                          | `The logo must not be animated.`                |
| 422    | `VALIDATION_MISSING`        | There is no `file` part, or a partner-group key sent no `organisation_id` | The `path` is `file` or `organisation_id`. See [Example 19](#example-19-response-422-validation-error). |

### Example 1 request

```bash
curl -X POST "https://api.chargebackstop.com/v1/receipt-defaults/logos" \
  -H "Authorization: Bearer <api_key>" \
  -F "file=@logo.png" \
  -F "organisation_id=org_xyz456"
```

### Example 1 response

Status `201`.

```json
{
  "id": "rdlogo_abc123",
  "organisation_id": "org_xyz456",
  "width": 240,
  "height": 80,
  "size_bytes": 5120,
  "created_at": "2026-12-03T10:00:00Z"
}
```

### Example 2 response - 422 logo dimensions too large

The image is 640 × 200 pixels.

```json
{
  "errors": [
    {
      "code": "LOGO_DIMENSIONS_TOO_LARGE",
      "message": "The logo must be at most 320 × 320 pixels."
    }
  ]
}
```

***

## The default merchant object

Field names are the same as the merchant fields of the [Orders API](/developer/api-documentation/orders#merchant-fields), except for the logo: this API takes `merchant_logo_upload_id` and returns `merchant_logo_url`.

| Field                               | Type           | Required on create | Validation                                                | Description                                                         |
| ----------------------------------- | -------------- | ------------------ | --------------------------------------------------------- | ------------------------------------------------------------------- |
| `id`                                | string         | Read-only          |                                                           | Default merchant ID                                                 |
| `organisation_id`                   | string         | Partner keys only  | An organisation that the key can access                   | Organisation that owns the merchant. You cannot change it.          |
| `merchant_reference_id`             | string         | Yes                | 1-255 characters                                          | Your reference for the merchant                                     |
| `merchant_name`                     | string         | Yes                | 1-255 characters                                          | Corporate name                                                      |
| `merchant_store_name`               | string         | Yes                | 1-255 characters                                          | Store name that the cardholder recognises                           |
| `merchant_store_description`        | string         | Yes                | 1-255 characters                                          | Store description                                                   |
| `merchant_contact_email`            | string         | Yes                | Valid email address, up to 254 characters                 | Receipt email                                                       |
| `merchant_customer_service_email`   | string         | Yes                | Valid email address, up to 254 characters                 | Support email                                                       |
| `merchant_contact_phone`            | string         | Yes                | E.164 format, such as `+442079460123`                     | Support phone                                                       |
| `merchant_address`                  | object         | Yes                | See [Merchant address](#merchant-address)                 | Merchant address                                                    |
| `merchant_store_url`                | string         | Yes                | `http`, `https`, `ftp`, or `ftps` URL, up to 255 characters                        | Store URL                                                           |
| `merchant_url`                      | string         | Yes                | `http`, `https`, `ftp`, or `ftps` URL, up to 255 characters                        | Merchant URL                                                        |
| `merchant_terms_and_conditions_url` | string         | Yes                | `http`, `https`, `ftp`, or `ftps` URL, up to 255 characters                        | Terms and conditions URL                                            |
| `merchant_refund_policy_url`        | string         | Yes                | `http`, `https`, `ftp`, or `ftps` URL, up to 255 characters                        | Refund policy URL                                                   |
| `merchant_logo_upload_id`           | string         | Yes                | A logo upload of the same organisation                    | Write-only. The logo for the merchant. Responses do not include it. |
| `merchant_logo_url`                 | string or null | Read-only          |                                                           | The URL of the logo. See [The logo URL](#the-logo-url).             |
| `created_at`                        | timestamp      | Read-only          |                                                           | When the merchant was created                                       |
| `updated_at`                        | timestamp      | Read-only          |                                                           | When the merchant was last changed                                  |
| `links`                             | array          | Read-only          |                                                           | `self`                                                              |

Default merchants added in the dashboard before this API was available can have empty fields. In responses, an empty field is `null`, and a merchant with no address has `merchant_address: null`.

### Merchant address

| Field                 | Type           | Required | Validation                                          |
| --------------------- | -------------- | -------- | --------------------------------------------------- |
| `line_1`              | string         | Yes      | 1-255 characters                                    |
| `line_2`              | string or null | No       | Up to 255 characters                                |
| `line_3`              | string or null | No       | Up to 255 characters                                |
| `city`                | string         | Yes      | 1-255 characters                                    |
| `country_subdivision` | string         | Yes      | 1-255 characters. State, province, or region.       |
| `postal_code`         | string         | Yes      | 1-255 characters                                    |
| `country`             | string         | Yes      | ISO 3166-1 alpha-2 code in upper case, such as `GB` |

When `merchant_address` is an object, it has all seven fields. A line that you did not send is `null`.

`city`, `country_subdivision`, `postal_code`, and at least one address line must not be blank.

### The logo URL

`merchant_logo_url` has this form:

```text
https://cdn.cbstop.com/receipt-logos/{merchant_id}.png
```

The URL is public. For a merchant with an uploaded logo, it stays the same for the life of the merchant. When you give the merchant a new logo, the same URL serves the new image, so you do not need to update it anywhere. After you delete the merchant, the URL returns `404`. The image can be cached for up to 5 minutes, so a new logo or a deletion can take that long to show.

A default merchant added before logo uploads were available can have no uploaded logo. For such a merchant, `merchant_logo_url` is the logo link that was entered in the dashboard, or `null`. To move the merchant to an uploaded logo, send `merchant_logo_upload_id` in a [PATCH request](#patch-v1-receipt-defaults-merchants-merchant_id-update-a-default-merchant). `merchant_logo_url` then changes to the URL above.

You cannot send `merchant_logo_url`. A request that has it returns `422` with the code `VALIDATION_EXTRA_FORBIDDEN`.

***

## POST /v1/receipt-defaults/merchants - Create a default merchant

Creates a default merchant with a logo that you uploaded.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### Request body

Send all the fields of the [default merchant object](#the-default-merchant-object) that are required on create, as JSON. `merchant_address.line_2` and `merchant_address.line_3` are optional.

### Important behaviour

* `merchant_logo_upload_id` must be a logo upload of the same organisation. If it is not, the response is `422 LOGO_UPLOAD_NOT_FOUND`.

### Example 3 request

```bash
curl -X POST "https://api.chargebackstop.com/v1/receipt-defaults/merchants" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "organisation_id": "org_xyz456",
    "merchant_reference_id": "larkspur-uk",
    "merchant_name": "Larkspur Trading Ltd",
    "merchant_store_name": "Larkspur Outdoor",
    "merchant_store_description": "Outdoor clothing and camping gear",
    "merchant_contact_email": "receipts@example.com",
    "merchant_customer_service_email": "support@example.com",
    "merchant_contact_phone": "+442079460123",
    "merchant_address": {
      "line_1": "12 Harbour Road",
      "line_2": "Unit 4",
      "city": "Bristol",
      "country_subdivision": "England",
      "postal_code": "BS1 6AA",
      "country": "GB"
    },
    "merchant_store_url": "https://shop.example.com",
    "merchant_url": "https://www.example.com",
    "merchant_terms_and_conditions_url": "https://www.example.com/terms",
    "merchant_refund_policy_url": "https://www.example.com/refunds",
    "merchant_logo_upload_id": "rdlogo_abc123"
  }'
```

### Example 3 response

Status `201`.

```json
{
  "id": "drfmrch_def456",
  "organisation_id": "org_xyz456",
  "merchant_reference_id": "larkspur-uk",
  "merchant_name": "Larkspur Trading Ltd",
  "merchant_store_name": "Larkspur Outdoor",
  "merchant_store_description": "Outdoor clothing and camping gear",
  "merchant_contact_email": "receipts@example.com",
  "merchant_customer_service_email": "support@example.com",
  "merchant_contact_phone": "+442079460123",
  "merchant_address": {
    "line_1": "12 Harbour Road",
    "line_2": "Unit 4",
    "line_3": null,
    "city": "Bristol",
    "country_subdivision": "England",
    "postal_code": "BS1 6AA",
    "country": "GB"
  },
  "merchant_store_url": "https://shop.example.com",
  "merchant_url": "https://www.example.com",
  "merchant_terms_and_conditions_url": "https://www.example.com/terms",
  "merchant_refund_policy_url": "https://www.example.com/refunds",
  "merchant_logo_url": "https://cdn.cbstop.com/receipt-logos/drfmrch_def456.png",
  "created_at": "2026-12-03T10:05:00Z",
  "updated_at": "2026-12-03T10:05:00Z",
  "links": [
    {
      "rel": "self",
      "uri": "/v1/receipt-defaults/merchants/drfmrch_def456"
    }
  ]
}
```

### Example 4 response - 422 logo upload not found

`merchant_logo_upload_id` is the ID of an upload in another organisation.

```json
{
  "errors": [
    {
      "code": "LOGO_UPLOAD_NOT_FOUND",
      "message": "No logo upload with this ID exists for this organisation."
    }
  ]
}
```

***

## GET /v1/receipt-defaults/merchants - List default merchants

Returns the default merchants that the API key can access, oldest first.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:read`

### Query parameters

| Parameter               | Type    | Description                                     |
| ----------------------- | ------- | ----------------------------------------------- |
| `organisation_id`       | string  | Filter by organisation ID                       |
| `merchant_reference_id` | string  | Filter by exact `merchant_reference_id`         |
| `limit`                 | integer | Number of results per page. Default `100`.      |
| `offset`                | integer | Number of results to skip. Default `0`.         |

### Example 5 request

```bash
curl -X GET "https://api.chargebackstop.com/v1/receipt-defaults/merchants?organisation_id=org_xyz456&limit=20&offset=0" \
  -H "Authorization: Bearer <api_key>"
```

### Example 5 response

```json
{
  "items": [
    {
      "id": "drfmrch_def456",
      "organisation_id": "org_xyz456",
      "merchant_reference_id": "larkspur-uk",
      "merchant_name": "Larkspur Trading Ltd",
      "merchant_store_name": "Larkspur Outdoor",
      "merchant_store_description": "Outdoor clothing and camping gear",
      "merchant_contact_email": "receipts@example.com",
      "merchant_customer_service_email": "support@example.com",
      "merchant_contact_phone": "+442079460123",
      "merchant_address": {
        "line_1": "12 Harbour Road",
        "line_2": "Unit 4",
        "line_3": null,
        "city": "Bristol",
        "country_subdivision": "England",
        "postal_code": "BS1 6AA",
        "country": "GB"
      },
      "merchant_store_url": "https://shop.example.com",
      "merchant_url": "https://www.example.com",
      "merchant_terms_and_conditions_url": "https://www.example.com/terms",
      "merchant_refund_policy_url": "https://www.example.com/refunds",
      "merchant_logo_url": "https://cdn.cbstop.com/receipt-logos/drfmrch_def456.png",
      "created_at": "2026-12-03T10:05:00Z",
      "updated_at": "2026-12-03T10:05:00Z",
      "links": [
        {
          "rel": "self",
          "uri": "/v1/receipt-defaults/merchants/drfmrch_def456"
        }
      ]
    }
  ],
  "count": 1
}
```

***

## GET /v1/receipt-defaults/merchants/{merchant_id} - Get a default merchant

Returns one default merchant.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:read`

### URL parameters

| Parameter     | Type   | Description         |
| ------------- | ------ | ------------------- |
| `merchant_id` | string | Default merchant ID |

### Example 6 request

```bash
curl -X GET "https://api.chargebackstop.com/v1/receipt-defaults/merchants/drfmrch_def456" \
  -H "Authorization: Bearer <api_key>"
```

### Example 6 response

The response is the default merchant object from Example 3.

***

## PATCH /v1/receipt-defaults/merchants/{merchant_id} - Update a default merchant

Changes the fields that you send. The other fields keep their values.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### URL parameters

| Parameter     | Type   | Description         |
| ------------- | ------ | ------------------- |
| `merchant_id` | string | Default merchant ID |

### Request body

Send, as JSON, the fields of the [default merchant object](#the-default-merchant-object) that you want to change. You cannot send `organisation_id` or `merchant_logo_url`. Each field that you send has the same validation as on create.

### Important behaviour

* We check only the fields that you send. A field that you leave out does not cause an error, even if its stored value would not pass the checks.
* `merchant_address` replaces the whole address. Send all its required fields. A line that you leave out becomes `null`.
* `null` is not accepted for a top-level field, and returns `422`. In `merchant_address`, only `line_2` and `line_3` accept `null`.
* To change the logo, upload a new one and send its ID as `merchant_logo_upload_id`. `merchant_logo_url` stays the same. See [The logo URL](#the-logo-url).
* If the merchant has no uploaded logo, every PATCH request must include `merchant_logo_upload_id`. Without it, the response is `422 LOGO_REQUIRED`.
* If no value changes, `updated_at` stays the same.

### Example 7 request

```bash
curl -X PATCH "https://api.chargebackstop.com/v1/receipt-defaults/merchants/drfmrch_def456" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_store_name": "Larkspur Outdoor Shop",
    "merchant_logo_upload_id": "rdlogo_ghi789"
  }'
```

### Example 7 response

```json
{
  "id": "drfmrch_def456",
  "organisation_id": "org_xyz456",
  "merchant_reference_id": "larkspur-uk",
  "merchant_name": "Larkspur Trading Ltd",
  "merchant_store_name": "Larkspur Outdoor Shop",
  "merchant_store_description": "Outdoor clothing and camping gear",
  "merchant_contact_email": "receipts@example.com",
  "merchant_customer_service_email": "support@example.com",
  "merchant_contact_phone": "+442079460123",
  "merchant_address": {
    "line_1": "12 Harbour Road",
    "line_2": "Unit 4",
    "line_3": null,
    "city": "Bristol",
    "country_subdivision": "England",
    "postal_code": "BS1 6AA",
    "country": "GB"
  },
  "merchant_store_url": "https://shop.example.com",
  "merchant_url": "https://www.example.com",
  "merchant_terms_and_conditions_url": "https://www.example.com/terms",
  "merchant_refund_policy_url": "https://www.example.com/refunds",
  "merchant_logo_url": "https://cdn.cbstop.com/receipt-logos/drfmrch_def456.png",
  "created_at": "2026-12-03T10:05:00Z",
  "updated_at": "2026-12-03T10:20:00Z",
  "links": [
    {
      "rel": "self",
      "uri": "/v1/receipt-defaults/merchants/drfmrch_def456"
    }
  ]
}
```

### Example 8 response - 422 logo required

The merchant has no uploaded logo, and the request does not include `merchant_logo_upload_id`.

```json
{
  "errors": [
    {
      "code": "LOGO_REQUIRED",
      "message": "Upload a logo for this merchant."
    }
  ]
}
```

***

## DELETE /v1/receipt-defaults/merchants/{merchant_id} - Delete a default merchant

Deletes a default merchant that no enrolment uses.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### URL parameters

| Parameter     | Type   | Description         |
| ------------- | ------ | ------------------- |
| `merchant_id` | string | Default merchant ID |

### Important behaviour

* If an enrolment uses the merchant, the response is `422 RECEIPT_DEFAULT_IN_USE`, and the message lists the IDs of those enrolments. To remove the enrolments from the merchant, edit it in the organisation's dashboard under **Settings > Deflection**.
* After the deletion, the logo URL of the merchant returns `404`. See [The logo URL](#the-logo-url).

### Example 9 request

```bash
curl -X DELETE "https://api.chargebackstop.com/v1/receipt-defaults/merchants/drfmrch_def456" \
  -H "Authorization: Bearer <api_key>"
```

### Example 9 response

Status `204` with no body.

### Example 10 response - 422 receipt default in use

```json
{
  "errors": [
    {
      "code": "RECEIPT_DEFAULT_IN_USE",
      "message": "Enrolments use this merchant. Remove it from them first. Enrolment IDs: enrl_abc123."
    }
  ]
}
```

***

## The default product object

| Field                  | Type      | Required on create | Validation                              | Description                               |
| ---------------------- | --------- | ------------------ | --------------------------------------- | ----------------------------------------- |
| `id`                   | string    | Read-only          |                                         | Default product ID                        |
| `organisation_id`      | string    | Partner keys only  | An organisation that the key can access | Organisation that owns the product. You cannot change it. |
| `name`                 | string    | Yes                | 1-255 characters                        | Product name                              |
| `product_reference_id` | string    | Yes                | 1-255 characters                        | Your reference for the product            |
| `product_url`          | string    | Yes                | `http`, `https`, `ftp`, or `ftps` URL, up to 255 characters      | Product page URL                          |
| `sku`                  | string    | Yes                | 1-255 characters                        | Stock keeping unit                        |
| `purchase_category`    | string    | Yes                | `MERCHANDISE` or `SERVICE`              | Type of purchase                          |
| `created_at`           | timestamp | Read-only          |                                         | When the product was created              |
| `updated_at`           | timestamp | Read-only          |                                         | When the product was last changed         |
| `links`                | array     | Read-only          |                                         | `self`                                    |

Default products added in the dashboard before this API was available can have `null` for `product_reference_id`, `product_url`, and `sku`.

***

## POST /v1/receipt-defaults/products - Create a default product

Creates a default product.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### Request body

Send all the fields of the [default product object](#the-default-product-object) that are required on create, as JSON.

### Example 11 request

```bash
curl -X POST "https://api.chargebackstop.com/v1/receipt-defaults/products" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "organisation_id": "org_xyz456",
    "name": "Two-person trail tent",
    "product_reference_id": "tent-2p",
    "product_url": "https://shop.example.com/products/tent-2p",
    "sku": "TENT-2P-GRN",
    "purchase_category": "MERCHANDISE"
  }'
```

### Example 11 response

Status `201`.

```json
{
  "id": "drfprd_jkl012",
  "organisation_id": "org_xyz456",
  "name": "Two-person trail tent",
  "product_reference_id": "tent-2p",
  "product_url": "https://shop.example.com/products/tent-2p",
  "sku": "TENT-2P-GRN",
  "purchase_category": "MERCHANDISE",
  "created_at": "2026-12-03T10:10:00Z",
  "updated_at": "2026-12-03T10:10:00Z",
  "links": [
    {
      "rel": "self",
      "uri": "/v1/receipt-defaults/products/drfprd_jkl012"
    }
  ]
}
```

***

## GET /v1/receipt-defaults/products - List default products

Returns the default products that the API key can access, oldest first.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:read`

### Query parameters

| Parameter              | Type    | Description                                |
| ---------------------- | ------- | ------------------------------------------ |
| `organisation_id`      | string  | Filter by organisation ID                  |
| `product_reference_id` | string  | Filter by exact `product_reference_id`     |
| `limit`                | integer | Number of results per page. Default `100`. |
| `offset`               | integer | Number of results to skip. Default `0`.    |

### Example 12 request

```bash
curl -X GET "https://api.chargebackstop.com/v1/receipt-defaults/products?product_reference_id=tent-2p" \
  -H "Authorization: Bearer <api_key>"
```

### Example 12 response

```json
{
  "items": [
    {
      "id": "drfprd_jkl012",
      "organisation_id": "org_xyz456",
      "name": "Two-person trail tent",
      "product_reference_id": "tent-2p",
      "product_url": "https://shop.example.com/products/tent-2p",
      "sku": "TENT-2P-GRN",
      "purchase_category": "MERCHANDISE",
      "created_at": "2026-12-03T10:10:00Z",
      "updated_at": "2026-12-03T10:10:00Z",
      "links": [
        {
          "rel": "self",
          "uri": "/v1/receipt-defaults/products/drfprd_jkl012"
        }
      ]
    }
  ],
  "count": 1
}
```

***

## GET /v1/receipt-defaults/products/{product_id} - Get a default product

Returns one default product.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:read`

### URL parameters

| Parameter    | Type   | Description        |
| ------------ | ------ | ------------------ |
| `product_id` | string | Default product ID |

### Example 13 request

```bash
curl -X GET "https://api.chargebackstop.com/v1/receipt-defaults/products/drfprd_jkl012" \
  -H "Authorization: Bearer <api_key>"
```

### Example 13 response

The response is the default product object from Example 11.

***

## PATCH /v1/receipt-defaults/products/{product_id} - Update a default product

Changes the fields that you send. The other fields keep their values.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### URL parameters

| Parameter    | Type   | Description        |
| ------------ | ------ | ------------------ |
| `product_id` | string | Default product ID |

### Request body

Send, as JSON, the fields of the [default product object](#the-default-product-object) that you want to change. You cannot send `organisation_id`. Each field that you send has the same validation as on create. `null` is not accepted for any field, and returns `422`. If no value changes, `updated_at` stays the same.

### Example 14 request

```bash
curl -X PATCH "https://api.chargebackstop.com/v1/receipt-defaults/products/drfprd_jkl012" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "sku": "TENT-2P-BLU"
  }'
```

### Example 14 response

```json
{
  "id": "drfprd_jkl012",
  "organisation_id": "org_xyz456",
  "name": "Two-person trail tent",
  "product_reference_id": "tent-2p",
  "product_url": "https://shop.example.com/products/tent-2p",
  "sku": "TENT-2P-BLU",
  "purchase_category": "MERCHANDISE",
  "created_at": "2026-12-03T10:10:00Z",
  "updated_at": "2026-12-03T10:25:00Z",
  "links": [
    {
      "rel": "self",
      "uri": "/v1/receipt-defaults/products/drfprd_jkl012"
    }
  ]
}
```

***

## DELETE /v1/receipt-defaults/products/{product_id} - Delete a default product

Deletes a default product that no enrolment uses.

**API level:** Partner-level and organisation-level\
**Authentication:** `receipt_defaults:write`

### URL parameters

| Parameter    | Type   | Description        |
| ------------ | ------ | ------------------ |
| `product_id` | string | Default product ID |

### Important behaviour

If an enrolment uses the product, the response is `422 RECEIPT_DEFAULT_IN_USE`, and the message lists the IDs of those enrolments: `Enrolments use this product. Remove it from them first. Enrolment IDs: enrl_abc123.` To remove the enrolments from the product, edit it in the organisation's dashboard under **Settings > Deflection**.

### Example 15 request

```bash
curl -X DELETE "https://api.chargebackstop.com/v1/receipt-defaults/products/drfprd_jkl012" \
  -H "Authorization: Bearer <api_key>"
```

### Example 15 response

Status `204` with no body.

***

## Common error responses

Error responses use this shape. Validation errors also have a `path`, which names the invalid value, or is `null` when the error is about the whole request body.

```json
{
  "errors": [
    {
      "code": "ERROR_CODE",
      "message": "Human readable message"
    }
  ]
}
```

| Status | Code                        | When                                                                                                                       |
| ------ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 401    | `UNAUTHORISED`              | The API key is invalid or expired                                                                                          |
| 403    | `FORBIDDEN`                 | The key does not have the required ability                                                                                 |
| 404    | `NOT_FOUND`                 | The record or organisation does not exist, the key cannot access it, or receipt defaults are not enabled for the organisation. A list returns it only when no organisation that the key can use has access. |
| 422    | `LOGO_TOO_LARGE`            | The logo file is larger than 1 MB                                                                                          |
| 422    | `LOGO_NOT_PNG`              | The logo file is not a valid PNG                                                                                           |
| 422    | `LOGO_DIMENSIONS_TOO_LARGE` | The logo is wider or higher than 320 pixels                                                                                |
| 422    | `LOGO_ANIMATED`             | The logo is an animated PNG                                                                                                |
| 422    | `LOGO_UPLOAD_NOT_FOUND`     | `merchant_logo_upload_id` is not a logo upload of the merchant's organisation                                              |
| 422    | `LOGO_REQUIRED`             | A PATCH request for a merchant with no uploaded logo does not include `merchant_logo_upload_id`                            |
| 422    | `RECEIPT_DEFAULT_IN_USE`    | You tried to delete a default merchant or product that an enrolment uses                                                   |
| 422    | `VALIDATION_<REASON>`       | A parameter or the request body does not match the schema. There is one entry for each problem, with a `path` that names the invalid value. |
| 429    | `RATE_LIMITED`              | The organisation or partner group went over the rate limit of the endpoint                                                 |

### Example 16 response - 401 unauthorised

```json
{
  "errors": [
    {
      "code": "UNAUTHORISED",
      "message": "Unauthorised"
    }
  ]
}
```

### Example 17 response - 403 missing ability

A key with only `receipt_defaults:read` sends a POST request.

```json
{
  "errors": [
    {
      "code": "FORBIDDEN",
      "message": "Forbidden"
    }
  ]
}
```

### Example 18 response - 404 not found

The key requests a default merchant in an organisation that it cannot access.

```json
{
  "errors": [
    {
      "code": "NOT_FOUND",
      "message": "Not found"
    }
  ]
}
```

### Example 19 response - 422 validation error

A partner-group key creates a default product without `organisation_id`.

```json
{
  "errors": [
    {
      "code": "VALIDATION_MISSING",
      "message": "organisation_id: Field required for partner API keys.",
      "path": "organisation_id"
    }
  ]
}
```

### Example 20 response - 429 rate limited

```json
{
  "errors": [
    {
      "code": "RATE_LIMITED",
      "message": "Too many requests"
    }
  ]
}
```
