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

# Product styles for Checkout and KYC/KYB

> Configure separate colors and light or dark themes for hosted Checkout and KYC/KYB experiences

Same API on both environments — build against test first, then go live by swapping the base URL and the key. [Environments and testing →](https://docs.cbpayapp.com/en/environment-testing.md)

## What this controls

Company accounts can give Checkout and KYC/KYB their own presentation while keeping one shared brand name, logo, website, support email and footer address. Configure it through the API or, if you are the company owner, in the portal at **Settings → Profile → Styles**.

The API and portal configure the same account-owned settings:

* `styles.checkout` controls the universal Checkout page and hosted card page.
* `styles.kyc` controls hosted KYC/KYB links and the verification wizard.
* Each product has three optional base colors: `color_primary`, `color_header` and `color_accent`.
* Each product can also override those colors independently in `light` and `dark` palettes. A missing palette block is preserved by the update; empty palette fields inherit.
* `theme` accepts `light`, `dark`, or `""` to use the product default: light for Checkout and dark for KYC/KYB.
* The logo and symbol belong to the shared account brand; they are not duplicated per product.

> [!NOTE]
>
> Only active company accounts can read these settings. Only the company owner can update them. Person accounts receive `403 company_account_required`; inactive accounts receive `403 account_blocked`.

## How inheritance works

Every empty value is resolved at render time through this order:

```mermaid theme={"theme":{"light":"github-light","dark":"github-dark"}}
flowchart LR
  P[Mode override] --> B[Product base]
  B --> A[Account brand]
  A --> O[Organization brand]
  O --> D[CBPay default]
```

A mode override wins over the product base, which wins over the shared account brand. The account brand wins over the organization brand, and CBPay supplies the final default. This resolution is applied independently to `color_primary`, `color_header`, `color_accent`, and `theme`. The `GET` response exposes raw editable values and a resolved `effective` value with top-level colors plus `light` and `dark` mirrors.

In `PUT /v1/account/branding`, an omitted product block is left unchanged. Inside a product block, base colors and `theme` replace their saved values. An omitted `light` or `dark` palette is preserved by read-modify-write; an included palette replaces that mode, and an empty field clears only that field so it inherits again.

## Configure with the API

### 1. Save the shared brand and product styles

Use the company owner's credential. This example gives Checkout a light theme and leaves KYC/KYB on its dark product default:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X PUT https://api.qbank.cl/platform/v1/account/branding \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "brand_name": "ACME Corp",
    "website": "https://acme.example",
    "footer_address": "Av. Siempre Viva 123, Santiago, Chile",
    "support_email": "support@acme.example",
    "color_primary": "1A2B3C",
    "color_header": "2E2E2E",
    "color_accent": "A16207",
    "styles": {
      "checkout": {
        "color_primary": "1A2B3C",
        "color_header": "FFFFFF",
        "color_accent": "A16207",
        "theme": "light",
        "light": {
          "color_primary": "1A2B3C",
          "color_header": "FFFFFF",
          "color_accent": ""
        },
        "dark": {
          "color_primary": "0F172A",
          "color_header": "111827",
          "color_accent": "FBC140"
        }
      },
      "kyc": {
        "theme": ""
      }
    }
  }'
```

Colors are six-digit hexadecimal values, with or without `#`. Text limits are 120 characters for `brand_name`, 200 for `website` and `footer_address`, and 254 for `support_email`. PNG logos are base64 encoded, limited to 512 KB and 2000×2000 pixels; omit a logo field to keep it, or send `""` to delete it.

A successful `200` response returns the complete effective brand. The important part is:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "custom": true,
  "styles": {
    "checkout": {
      "color_primary": "1A2B3C",
      "color_header": "FFFFFF",
      "color_accent": "A16207",
      "theme": "light",
      "light": {
        "color_primary": "1A2B3C",
        "color_header": "FFFFFF",
        "color_accent": ""
      },
      "dark": {
        "color_primary": "0F172A",
        "color_header": "111827",
        "color_accent": "FBC140"
      },
      "custom": true,
      "effective": {
        "color_primary": "#1A2B3C",
        "color_header": "#FFFFFF",
        "color_accent": "#A16207",
        "theme": "light",
        "light": {
          "color_primary": "#1A2B3C",
          "color_header": "#FFFFFF",
          "color_accent": "#A16207"
        },
        "dark": {
          "color_primary": "#0F172A",
          "color_header": "#111827",
          "color_accent": "#FBC140"
        }
      }
    },
    "kyc": {
      "theme": "",
      "custom": false,
      "effective": {
        "color_primary": "#1A2B3C",
        "color_header": "#2E2E2E",
        "color_accent": "#A16207",
        "theme": "dark",
        "light": {
          "color_primary": "#1A2B3C",
          "color_header": "#2E2E2E",
          "color_accent": "#A16207"
        },
        "dark": {
          "color_primary": "#1A2B3C",
          "color_header": "#2E2E2E",
          "color_accent": "#A16207"
        }
      }
    }
  }
}
```

### 2. Read the values before showing a preview

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl https://api.qbank.cl/platform/v1/account/branding \
  -H "Authorization: Bearer <token>"
```

Use `styles.<product>.effective` for a preview of the rendered product, or use its `effective.light` and `effective.dark` mirrors to preview both modes. Use the sibling base, `light`, `dark`, and `theme` fields when you need to edit only the account override. This endpoint returns no PII.

## Configure in the company portal

1. Sign in with the company owner account.
2. Open **Settings → Profile → Styles**, or go directly to `/settings?tab=styles`.
3. Edit the shared brand: name, logo, symbol, website, support email and footer address.
4. Choose **Checkout** or **KYC/KYB**. Set the shared base colors, then expand **Light** and **Dark** to set optional per-mode palettes.
5. Check the merged preview for each product and mode, then save.

The tab is available only to company accounts and is owner-only. A member or a person account must use the API with the appropriate owner context; the server remains the authority for authorization.

The wizard's **thanks** page and the legal **Terms** and **Privacy** pages inherit the `?theme=` query value from the verification flow. Unsupported values fail closed to dark, and the wizard's light tokens remain pinned under the dark override so the selected palette is not accidentally inverted.

## When changes appear

Checkout reads the effective style when the hosted experience renders. A live universal Checkout URL and its hosted card page therefore use the current account style when opened again.

KYC/KYB links freeze the effective brand and product style when the link is created. Updating the account later does not restyle an already issued link; create a new link when a pending customer must receive the new theme. This prevents a customer’s active verification flow from changing halfway through.

The fixed **Powered by CBPay** disclosure remains visible and cannot be removed or recolored. It is separate from your account brand.

## States and safe updates

| State | Meaning | What to do |
| - | - | - |
| `custom: true` | This product has at least one account-level override. | Edit the raw product fields or clear individual fields to inherit. |
| `custom: false` | No account-level product override is active. | The `effective` block shows the inherited result. |
| `theme: light` | Explicit light theme. | Use for a bright hosted experience. |
| `theme: dark` | Explicit dark theme. | Use for a dark hosted experience. |
| `theme: ""` | Product default. | Checkout resolves to light; KYC/KYB resolves to dark. |

There is no retry or financial action in this endpoint. If a request times out, read the resource before sending another update; when retrying an intentional update, send the same complete desired values. This is a read-modify-write API: omit a mode to preserve it, include a mode with empty fields to clear only those overrides.

## Errors

| HTTP | Code | Solution |
| -: | - | - |
| 400 | `invalid_color` | Send six hexadecimal digits, optionally prefixed with `#`. |
| 400 | `invalid_theme` | Send `light`, `dark` or an empty string. |
| 400 | `text_too_long` | Shorten the named text field to its documented limit. |
| 400 / 413 | `invalid_logo`, `unsupported_logo`, `logo_too_large` | Send a PNG within 512 KB and 2000×2000 pixels, or omit/delete the logo. |
| 401 | `unauthorized` | Refresh the credential and send it as a Bearer token. |
| 403 | `company_account_required` | Use an active company account. |
| 403 | `account_blocked` | Ask an authorized operator to restore the account. |

See [Errors](https://docs.cbpayapp.com/en/errors.md) for the common response envelope.

## FAQ

> [accordion] Can I style Checkout and KYC/KYB differently?
>
> Yes. Set `styles.checkout` and `styles.kyc` independently. The shared name and logos remain available to both products.

> [accordion] What happens if I omit a product or its light/dark palette?
>
> An omitted product block is unchanged. An omitted `light` or `dark` block is also preserved. Include the block and send empty strings only for the fields that should inherit.

> [accordion] Why does an empty theme not look the same in both products?
>
> Empty means the product default, not a global theme. Checkout defaults to light and KYC/KYB defaults to dark.

> [accordion] Will changing the style update a KYC link I already sent?
>
> No. KYC/KYB links use a frozen snapshot created with the link. Create a new link to use the new style.

> [accordion] Can a person account use the Styles tab?
>
> No. Product styles are available to active company accounts, and portal updates are restricted to the company owner.

> [accordion] Do the thanks and legal pages follow the selected theme?
>
> Yes. The wizard passes `?theme=` to the thanks, Terms and Privacy pages. Unknown or invalid values fail closed to dark.

> [accordion] Do I need to pass branding when creating a Checkout or KYC link?
>
> No. The platform resolves the style from the account that owns the link. Keep the account branding current before creating KYC/KYB links.


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