> ## 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 的已发布克隆形式创建新的自定义 checkout

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

新 checkout 创建时即为 **`PUBLISHED`** 状态，是账户默认 checkout 的克隆：支付方式（包括图标和名称覆盖以及必填字段条件集）会被复制；在该 checkout 首次[发布](https://docs.y.uno/zh-hans/reference/checkout-builder/publish-checkout-configuration.md)之前，通用设置和样式沿用账户的基准配置。新 checkout 永远不会被创建为账户的默认 checkout。

响应中顶层的 `id` 即 `checkout_code`，供[获取](https://docs.y.uno/zh-hans/reference/checkout-builder/fetch-checkout-configuration.md)、[发布](https://docs.y.uno/zh-hans/reference/checkout-builder/publish-checkout-configuration.md)和[管理 Checkout 生命周期](https://docs.y.uno/zh-hans/reference/checkout-builder/manage-checkout-lifecycle.md) endpoint 使用。

`name` 为必填项，不能为空，且在每个账户内唯一；重复的名称会被拒绝并返回 `409`。如果账户没有可供克隆的默认 checkout，请求会被拒绝并返回 `404`。


## OpenAPI

````yaml openapi/zh-hans/checkout-builder/create-checkout.json POST /checkouts
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:
    post:
      summary: 创建 Checkout
      description: >-
        以账户默认 checkout 的已发布克隆形式创建一个新的自定义 checkout：支付方式（包括图标/名称覆盖和必填字段条件集）从默认
        checkout 复制；常规设置和样式在该 checkout 首次发布之前沿用账户基线。新 checkout 创建时状态为
        PUBLISHED，且绝不会是账户的默认 checkout。标识符以顶层 `id` 的形式返回。
      operationId: create-checkout
      parameters:
        - name: X-Idempotency-Key
          in: header
          description: 可选的客户端密钥，最多 64 个字符。尽力而为：重复发送相同的密钥不保证会被去重。
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: Checkout 名称。必填，不能为空白，且在每个账户内唯一（名称重复会以 409 被驳回）。
                description:
                  type: string
                  description: 可选的自由文本描述。
            examples:
              Name only:
                value:
                  name: Promo Checkout
              Name and description:
                value:
                  name: Promo Checkout
                  description: Seasonal promo storefront
      responses:
        '201':
          description: >-
            创建的 checkout。创建时状态为 PUBLISHED，是账户默认 checkout 的克隆；创建时 `is_default`
            始终为 false。在其他 Checkout Builder endpoint 中将 `id` 用作 checkout_code。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutMutationResponse'
              examples:
                Created:
                  value:
                    id: 0b28ff66-15f1-44c1-8d1e-bd1fefbc0a19
                    name: Promo Checkout
                    description: Seasonal promo storefront
                    is_default: false
                    is_active: true
                    created_at: '2026-07-17T10:02:33.000Z'
        '400':
          description: 缺少 `name` 或 `name` 为空白，或 JSON 请求体格式错误。
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  messages:
                    type: array
                    items:
                      type: string
              examples:
                Missing name:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - name is required
        '401':
          description: 未通过身份验证，或账户不在 beta 允许列表中。
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: NOT_AUTHENTICATED
                    messages:
                      - Not authenticated
        '404':
          description: 账户没有可供克隆的默认 checkout。
          content:
            application/json:
              examples:
                No default checkout:
                  value:
                    code: DEFAULT_CHECKOUT_NOT_FOUND
                    messages:
                      - >-
                        No default Custom Checkout found for account:
                        78163a7c-c63c-4fdd-b72b-d5f77093a927
        '409':
          description: 该账户下已存在同名 checkout。
          content:
            application/json:
              examples:
                Duplicate name:
                  value:
                    code: DUPLICATE_CHECKOUT_NAME
                    messages:
                      - >-
                        A Custom Checkout with name 'Promo Checkout' already
                        exists for this account
components:
  schemas:
    CheckoutMutationResponse:
      type: object
      properties:
        id:
          type: string
          description: Checkout 标识符（UUID）。在获取、发布和生命周期 endpoint 中将其用作 checkout_code。
        name:
          type: string
          description: Checkout 名称。
        description:
          type: string
          description: Checkout 描述。
        is_default:
          type: boolean
          description: 此 checkout 是否为账户的默认 checkout。新创建的 checkout 绝不会是默认 checkout。
        is_active:
          type: boolean
          description: checkout 是否处于启用状态（正在承载流量）。
        created_at:
          type: string
          format: date-time
          description: 创建时间戳（ISO-8601）。
  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.