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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 发布 Checkout 配置

> 通过 checkout code 发布 checkout 的配置和/或样式

> [!NOTE]
>
> 此 API 处于 **Beta** 阶段。endpoint 和 schema 可能会在不另行通知的情况下变更。


## OpenAPI

````yaml openapi/zh-hans/checkout-builder/publish-checkout-configuration.json PUT /checkouts/{checkout_code}
openapi: 3.1.0
info:
  title: checkout-builder
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - publicApiKey: []
    privateSecretKey: []
    accountCode: []
paths:
  /checkouts/{checkout_code}:
    put:
      summary: 发布 Checkout 配置
      description: >-
        通过一次调用为 checkout 写入配置和/或样式。请求体可包含 `config` 对象、`styling`
        对象，或两者都包含；至少需要其中一个。当请求体包含 `config` 时，还必须提供
        `name`。每个部分在应用前都会独立验证；只要有任何一条规则未通过，请求就会以一个汇总的 400 被驳回，且不会应用任何内容。配置为稀疏
        upsert（省略的支付方式保持其之前的状态；不能创建新的支付方式）。样式为部分合并（省略或为 null 的字段会被保留）。
      operationId: publish-checkout-configuration
      parameters:
        - name: checkout_code
          in: path
          description: 要更新的 checkout 的唯一标识符（UUID，36 个字符）。非 UUID 的值会在处理前以 400 被驳回。
          schema:
            type: string
          required: true
        - name: X-Idempotency-Key
          in: header
          description: 客户端生成的 UUID。使用相同的密钥重复发送同一请求是安全的，不会重复发布。
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            examples:
              Configuration and styling:
                value:
                  name: Main Checkout
                  config:
                    payment_methods:
                      - payment_method_type: CARD
                        type: PAYMENT_METHOD
                        order_to_show: 0
                        is_active: true
                        active_enrollment_type: BOTH
                        conditions_to_override: []
                        required_fields_to_override:
                          is_active: true
                          fields:
                            - field_name: security_code
                              is_active: true
                              current_value: ALWAYS
                              conditions_to_override:
                                - name: BR only
                                  is_active: true
                                  priority: 1
                                  conditions:
                                    - condition_type: COUNTRY
                                      conditional: ONE_OF
                                      values:
                                        - BR
                          enrollment_fields: []
                          is_enrollment_active: true
                    general_settings:
                      country_documents:
                        - country_code: BR
                          documents:
                            - CPF
                            - CNPJ
                  styling:
                    styles:
                      global:
                        accent_color: '#1A73E8'
                        primary_background_color: '#FFFFFF'
                        font_family: Inter
                      header:
                        logo: https://cdn.example.com/logo.png
                        font_weight: 600
                      button:
                        corner_radius: 8
                        font_weight: 500
                    flags:
                      force_default_styles: false
              Hide a field on the card form:
                value:
                  name: My Checkout
                  config:
                    payment_methods:
                      - payment_method_type: CARD
                        type: PAYMENT_METHOD
                        order_to_show: 1
                        is_active: true
                        active_enrollment_type: BOTH
                        required_fields_to_override:
                          is_active: true
                          fields:
                            - field_name: phone
                              is_active: false
            schema:
              type: object
              description: '`config` 或 `styling` 至少需要提供一个。发送 `config` 时必须提供 `name`。'
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 50
                  description: >-
                    Checkout 配置的名称（1 到 50 个字符）。请求体包含 `config` 时必填；包含 `config`
                    但没有 `name` 的请求会返回 400 `name must not be
                    blank`。仅包含样式的请求无需提供。该值会替换当前 checkout 名称，因此如需保留，请发送当前名称。
                  example: Main checkout
                config:
                  type: object
                  description: Checkout 配置：支付方式和常规设置。稀疏 upsert；省略的支付方式保持其之前的状态。
                  properties:
                    payment_methods:
                      type: array
                      description: 要更新的支付方式。顺序由 `order_to_show` 决定（值越小越靠前）。
                      items:
                        type: object
                        properties:
                          payment_method_type:
                            type: string
                            description: 支付方式类型，例如 CARD、PAYPAL、NU_PAY、GOOGLE_PAY。
                            example: CARD
                          type:
                            type: string
                            enum:
                              - PAYMENT_METHOD
                              - ENROLLMENT
                            description: >-
                              对于给定的
                              `payment_method_type`，此条目更新哪一条已存储的记录：一次性支付流程（`PAYMENT_METHOD`），或注册/已保存卡流程（`ENROLLMENT`）。现有记录通过此字段匹配；省略它意味着没有记录匹配，因此
                              `fields` 会被静默忽略（请求仍会返回
                              200，但未注册的卡表单不会改变）。当该支付方式已有已存储的注册记录时，`enrollment_fields`
                              仍然适用。
                          order_to_show:
                            type: integer
                            description: 显示顺序（>= 0）。值越小越靠前显示。
                            example: 0
                          is_active:
                            type: boolean
                            description: 是否提供该支付方式。
                            example: true
                          active_enrollment_type:
                            type: string
                            enum:
                              - ENROLLMENT
                              - NO_ENROLLMENT
                              - BOTH
                              - NONE
                            description: 该支付方式的注册策略。
                          conditions_to_override:
                            type: array
                            description: >-
                              支付方式级别的条件集，用于控制该支付方式何时显示。客户端提供的条件集
                              `code`（UUID）会被保留。
                            items:
                              type: object
                          required_fields_to_override:
                            type: object
                            description: >-
                              按字段配置。`fields` = 未注册流程；`enrollment_fields` =
                              已注册（已保存卡）流程。每个字段最多一个条件集（第二个会以 400 被驳回）。
                            properties:
                              is_active:
                                type: boolean
                              fields:
                                type: array
                                description: 未注册（一次性支付）流程的按字段覆盖。
                                items:
                                  type: object
                                  properties:
                                    field_name:
                                      type: string
                                      description: 要覆盖的表单字段，例如 `phone`、`security_code`。
                                      example: phone
                                    is_active:
                                      type: boolean
                                      description: >-
                                        该字段是否在表单上显示/必填。这是该字段的开关：设置为 `false`
                                        可将其隐藏。
                                      example: false
                                    current_value:
                                      type: string
                                      enum:
                                        - ALWAYS
                                        - FIRST_TIME
                                        - NONE
                                      description: >-
                                        要应用的固定值，而不是让付款人自行输入。仅对 `security_code`
                                        有意义。`NONE` 在未注册的 CARD 流程中会返回 400。与
                                        `is_active` 无关。
                                      example: ALWAYS
                                    conditions_to_override:
                                      type: array
                                      description: >-
                                        控制此字段覆盖何时生效的条件，例如按国家/地区。每个字段最多一个条件集；第二个会以
                                        400 被驳回。
                                      items:
                                        type: object
                                  required:
                                    - field_name
                                    - is_active
                              enrollment_fields:
                                type: array
                                description: 已注册（已保存卡）流程的按字段覆盖。结构与 `fields` 相同。
                                items:
                                  type: object
                                  properties:
                                    field_name:
                                      type: string
                                      description: 要覆盖的表单字段，例如 `phone`、`security_code`。
                                      example: phone
                                    is_active:
                                      type: boolean
                                      description: >-
                                        该字段是否在表单上显示/必填。这是该字段的开关：设置为 `false`
                                        可将其隐藏。
                                      example: false
                                    current_value:
                                      type: string
                                      enum:
                                        - ALWAYS
                                        - FIRST_TIME
                                        - NONE
                                      description: >-
                                        要应用的固定值，而不是让付款人自行输入。仅对 `security_code`
                                        有意义。`NONE` 在未注册的 CARD 流程中会返回 400。与
                                        `is_active` 无关。
                                      example: ALWAYS
                                    conditions_to_override:
                                      type: array
                                      description: >-
                                        控制此字段覆盖何时生效的条件，例如按国家/地区。每个字段最多一个条件集；第二个会以
                                        400 被驳回。
                                      items:
                                        type: object
                                  required:
                                    - field_name
                                    - is_active
                              is_enrollment_active:
                                type: boolean
                    general_settings:
                      type: object
                      properties:
                        country_documents:
                          type: array
                          items:
                            type: object
                            properties:
                              country_code:
                                type: string
                                description: ISO 3166-1 alpha-2 国家/地区代码。
                                example: BR
                              documents:
                                type: array
                                items:
                                  type: string
                                example:
                                  - CPF
                                  - CNPJ
                styling:
                  type: object
                  description: >-
                    Checkout 样式和 SDK 设置。部分合并；省略或为 null 的字段会被保留；使用
                    `flags.force_default_styles`
                    进行重置。`settings.urls`、`settings.click_to_pay`、`settings.form`
                    和 `settings.google_pay` 处于 beta 锁定状态，若以非空值发送会被驳回。
                  properties:
                    styles:
                      type: object
                      description: >-
                        全局、标头和按钮样式。所有 `*_color` 字段必须为 6 位或 8 位十六进制颜色（#RRGGBB /
                        #RRGGBBAA）；`font_weight` 必须为 100..900 之一（步长
                        100）；`font_family` 必须在支持的目录中，或在 `external_fonts`
                        中声明。徽标必须是指向公共主机的 HTTPS URL 或相对路径（不允许
                        data:/SVG/javascript:）。
                    settings:
                      type: object
                      description: >-
                        SDK 设置，转发给 checkout
                        SDK。`settings.urls`、`settings.click_to_pay`、`settings.form`
                        和 `settings.google_pay` 处于 beta 锁定状态，若以非空值发送会被驳回。
                      properties:
                        card:
                          type: object
                          description: 卡 SDK 设置。
                          properties:
                            save_on_success:
                              type: boolean
                              description: 提供为将来的支付保存卡的选项。
                            visualization_mode:
                              type: string
                              description: 卡表单的显示模式。
                            enable_ocr:
                              type: boolean
                              description: 启用卡片扫描（OCR）。
                            credit_card_only_processing:
                              type: boolean
                              description: 仅处理信用卡。
                            enable_payment_retry:
                              type: boolean
                              description: 允许对被拒绝的卡支付进行重试。
                            default_network:
                              type: string
                              description: 默认卡组织网络：DOM 或 INT。
                        sdk_type:
                          type: object
                        web_sdk:
                          type: object
                        payment_method_list:
                          type: object
                        ui:
                          type: object
                    flags:
                      type: object
                      properties:
                        force_default_styles:
                          type: boolean
                    external_fonts:
                      type: array
                      description: 自定义字体。`files[].url` 必须是指向公共主机的 HTTPS URL。
                      items:
                        type: object
                    payment_link_styles:
                      type: object
      responses:
        '200':
          description: >-
            已更新 checkout 的摘要。此响应不会返回配置和样式；请使用[获取 checkout
            配置](/zh-hans/reference/checkout-builder/fetch-checkout-configuration)读取。其标识符以顶层
            `id` 的形式返回。
          content:
            application/json:
              examples:
                Success:
                  value:
                    id: 8005ca91-dcfb-4428-b9f6-49c6e3446474
                    name: Main Checkout
                    description: Default checkout
                    is_default: true
                    is_active: true
                    created_at: '2026-10-22T03:16:36Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 8005ca91-dcfb-4428-b9f6-49c6e3446474
                  name:
                    type: string
                    example: Main Checkout
                  description:
                    type: string
                    example: Default checkout
                  is_default:
                    type: boolean
                    example: true
                  is_active:
                    type: boolean
                    example: true
                  created_at:
                    type: string
                    example: '2026-10-22T03:16:36Z'
        '400':
          description: 验证失败。所有违规项会汇总在一个响应中返回。JSON 请求体格式错误同样会返回 400。
          content:
            application/json:
              examples:
                Invalid parameters:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - payment_methods[0].order_to_show must be >= 0
                      - >-
                        styles.global.accent_color must be a 6- or 8-digit hex
                        color (#RRGGBB or #RRGGBBAA)
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_PARAMETERS
                  messages:
                    type: array
                    items:
                      type: string
        '401':
          description: 未通过身份验证，或账户不在 beta 允许列表中。
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: NOT_AUTHENTICATED
                    messages:
                      - Not authenticated
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: NOT_AUTHENTICATED
                  messages:
                    type: array
                    items:
                      type: string
        '404':
          description: 在此账户下未找到该 checkout。
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  messages:
                    type: array
                    items:
                      type: string
      deprecated: false
components:
  securitySchemes:
    publicApiKey:
      type: apiKey
      in: header
      name: PUBLIC-API-KEY
      description: 商户公钥 API 密钥。可在 Yuno Dashboard → Settings → API Keys 中找到。
    privateSecretKey:
      type: apiKey
      in: header
      name: PRIVATE-SECRET-KEY
      description: 商户私有密钥，与公钥配对使用。切勿嵌入客户端代码。
    accountCode:
      type: apiKey
      in: header
      name: X-Account-Code
      description: 请求所属商户账户范围的 UUID。租户仅通过此标头解析。

````

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