# Publish Checkout Configuration

<Note>This API is in **Beta**. Endpoints and schemas may change without prior notice.</Note>

**PUT** `/checkouts/{checkout_code}`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Writes configuration and/or styling for the checkout in a single call. The body may contain a `config` object, a `styling` object, or both; at least one is required. Each part is validated independently before being applied; if any rule fails, the request is rejected with a single aggregated 400 and nothing is applied. Configuration is a sparse upsert (omitted payment methods keep their previous state; new methods cannot be created). Styling is a partial merge (omitted or null fields are preserved).

## Authorization

- PUBLIC-API-KEY (apiKey in header)
- PRIVATE-SECRET-KEY (apiKey in header)
- X-Account-Code (apiKey in header)

## Header parameters

- `X-Idempotency-Key` (string)
  Client-generated UUID. Re-sending the same request with the same key is safe and will not double-publish.

## Path parameters

- `checkout_code` (string, required)
  The unique identifier of the checkout to update (UUID, 36 chars). Non-UUID values are rejected with 400 before processing.

## Body

Content type: `application/json`

- `config` (object)
  Checkout configuration: payment methods and general settings. Sparse upsert; omitted payment methods keep their previous state.
  - `payment_methods` (object[])
    Payment methods to update. Order is driven by `order_to_show` (lower = first).
    - `payment_method_type` (string)
      Payment method type, e.g. CARD, PAYPAL, NU_PAY, GOOGLE_PAY.
    - `order_to_show` (integer)
      Display order (>= 0). Lower is shown first.
    - `is_active` (boolean)
      Whether the method is offered.
    - `active_enrollment_type` ("ENROLLMENT" | "NO_ENROLLMENT" | "BOTH" | "NONE")
      Enrollment posture for the method.
    - `conditions_to_override` (object[])
      Payment-method-level condition sets that gate when the method appears. A client-supplied set `code` (UUID) is preserved.
    - `required_fields_to_override` (object)
      Per-field configuration. `fields` = non-enrolled flow; `enrollment_fields` = enrolled (saved-card) flow. At most one condition set per field (a second is rejected with 400).
      - `is_active` (boolean)
      - `fields` (object[])
      - `enrollment_fields` (object[])
      - `is_enrollment_active` (boolean)
  - `general_settings` (object)
    - `country_documents` (object[])
      - `country_code` (string)
        ISO 3166-1 alpha-2 country code.
      - `documents` (string[])
- `styling` (object)
  Checkout styling and SDK settings. Partial merge; omitted or null fields are preserved; use `flags.force_default_styles` to reset. `settings.urls`, `settings.click_to_pay`, `settings.form` and `settings.google_pay` are beta-locked and rejected if sent with a non-empty value.
  - `styles` (object)
    global, header and button styles. All `*_color` fields must be a 6- or 8-digit hex color (#RRGGBB / #RRGGBBAA); `font_weight` must be one of 100..900 (step 100); `font_family` must be in the supported catalog or declared in `external_fonts`. Logos must be an HTTPS URL to a public host or a relative path (no data:/SVG/javascript:).
  - `settings` (object)
    SDK settings, forwarded to the checkout SDK. `settings.urls`, `settings.click_to_pay`, `settings.form` and `settings.google_pay` are beta-locked and rejected if sent with a non-empty value.
    - `card` (object)
      Card SDK settings.
      - `save_on_success` (boolean)
        Offer to save the card for future payments.
      - `visualization_mode` (string)
        Card form visualization mode.
      - `enable_ocr` (boolean)
        Enable card scanning (OCR).
      - `credit_card_only_processing` (boolean)
        Process credit cards only.
      - `enable_payment_retry` (boolean)
        Allow retrying a declined card payment.
      - `default_network` (string)
        Default card network: DOM or INT.
    - `sdk_type` (object)
    - `web_sdk` (object)
    - `payment_method_list` (object)
    - `ui` (object)
  - `flags` (object)
    - `force_default_styles` (boolean)
  - `external_fonts` (object[])
    Custom fonts. `files[].url` must be an HTTPS URL to a public host.
  - `payment_link_styles` (object)

Example:

```json
{
  "config": {
    "payment_methods": [
      {
        "payment_method_type": "CARD",
        "order_to_show": 0,
        "is_active": true,
        "active_enrollment_type": "ENROLLMENT",
        "conditions_to_override": [
          {}
        ],
        "required_fields_to_override": {
          "is_active": true,
          "fields": [
            {}
          ],
          "enrollment_fields": [
            {}
          ],
          "is_enrollment_active": true
        }
      }
    ],
    "general_settings": {
      "country_documents": [
        {
          "country_code": "BR",
          "documents": [
            "CPF",
            "CNPJ"
          ]
        }
      ]
    }
  },
  "styling": {
    "styles": {},
    "settings": {
      "card": {
        "save_on_success": true,
        "visualization_mode": "string",
        "enable_ocr": true,
        "credit_card_only_processing": true,
        "enable_payment_retry": true,
        "default_network": "string"
      },
      "sdk_type": {},
      "web_sdk": {},
      "payment_method_list": {},
      "ui": {}
    },
    "flags": {
      "force_default_styles": true
    },
    "external_fonts": [
      {}
    ],
    "payment_link_styles": {}
  }
}
```

## Responses

### 200

The updated checkout (configuration + styling composed). Its identifier is exposed as the top-level `id`.

Example:

```json
{}
```

### 400

Validation failed. All violations are aggregated into a single response. A malformed JSON body also returns 400.

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_PARAMETERS",
  "messages": [
    "string"
  ]
}
```

### 401

Not authenticated, or the account is not in the beta allowlist.

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "NOT_AUTHENTICATED",
  "messages": [
    "string"
  ]
}
```

### 404

The checkout was not found for this account.

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```