> ## 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.

# 创建分期付款计划

> 创建分期付款计划，定义金额范围、卡 BIN、币种和可用性规则

Yuno 允许您创建分期付款计划，提供给您的客户。这些计划可以根据应付金额、币种和所用卡片等因素使用，如下所述：

* **按金额范围筛选（必填）：** 系统检查该分期付款计划是否适用于您交易的特定金额。仅考虑能够处理该金额的计划。
* **卡 BIN：** 系统验证您卡片的 BIN 是否与某些分期付款计划允许的 BIN 匹配。如果匹配，则考虑该计划。
* **特定币种：** 仅考虑适用于您所用币种的计划。
* **计划可用性：** 系统检查该分期付款计划是否处于活跃状态。仅考虑未过期且可用的计划。

> [!NOTE]
>
> **定义计划 ID**
>
> 仅当应用在购买过程中不会改变的固定分期付款计划时，才需要 `plan_id`。如果未提供 `installment.plan_id`，SDK 将自动搜索与该账户关联的所有可用分期付款计划，并选择其认为最合适的计划。您应包含 `plan_id`，以确保应用特定的计划。

> [!NOTE]
>
> **商户分期付款**
>
> 此 endpoint 仅在[商户分期付款集成](https://docs.y.uno/zh-hans/docs/payment-features/installments.md)中需要。对于服务提供商定义的分期付款，我们使用您的支付服务提供商定义的分期付款计划。

对于商户创建的分期付款，您还可以在[创建结账会话](https://docs.y.uno/zh-hans/reference/checkout-sessions/create-checkout-session.md)时使用 `plan_id`，为每个结账会话指定计划。如果您不发送该参数，我们将使用与结账会话所设条件相匹配的分期付款计划。


## OpenAPI

````yaml openapi/zh-hans/installments/create-installments-plan.json POST /installments-plans
openapi: 3.1.0
info:
  title: installments
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /installments-plans:
    post:
      summary: 创建分期计划
      operationId: create-installments-plan
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - account_id
                - merchant_reference
                - installments_plan
              properties:
                name:
                  type: string
                  description: 分期计划名称（MAX 255；MIN 3）
                account_id:
                  type: array
                  description: 将使用该分期计划的账户的唯一标识符（UUID；36 个字符）。
                  default: '{{account_id}}'
                  items:
                    type: string
                merchant_reference:
                  type: string
                  description: 分期计划的标识（MAX 255；MIN 3）
                installments_plan:
                  type: array
                  description: 各场景下可用分期的定义
                  items:
                    properties:
                      installment:
                        type: integer
                        description: 购物者可选择的按月分期付款期数
                        format: int32
                      rate:
                        type: number
                        description: >-
                          使用分期付款后，支付服务提供商对交易最终金额应用的费率。该值应以乘数形式输入，而不是百分比。例如，要应用
                          20% 的费率，请输入 `1.20` 而不是 `20`。
                        format: float
                      financial_costs:
                        type: array
                        description: 此分期选项的财务成本详情，可选。
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              description: |-
                                财务成本类型标识符（MIN 3；MAX 255）。

                                <br/> 示例：`CFT`、`TEA`、`CET`、`CAT`
                            rate:
                              type: number
                              description: 以小数表示的财务成本费率（例如 45.25 表示 45.25%）。
                              minimum: 0
                              maximum: 100000
                              format: float
                          required:
                            - type
                            - rate
                      type:
                        type: string
                        description: 分期类型。仅适用于厄瓜多尔和墨西哥。Merchant 表示带利息的延期付款，Issuer 表示免息的延期付款
                        enum:
                          - MERCHANT_INSTALLMENTS
                          - ISSUER_INSTALLMENTS
                    required:
                      - installment
                    type: object
                country_code:
                  type: string
                  description: 发卡机构所在国家（ISO 3166-1，MAX 2；MIN 2）
                brand:
                  type: array
                  description: 卡品牌信息（MAX 255；MIN 3）。
                  items:
                    type: string
                issuer:
                  type: string
                  description: 发卡机构（MAX 255；MIN 3）
                iin:
                  type: array
                  description: 发卡机构识别码（IIN）是金融机构所发支付卡卡号的前几位数字（MAX 8；MIN 6）
                  items:
                    type: string
                first_installment_deferral:
                  type: integer
                  description: '首期分期扣款前需等待的月数（MAX: 3）。'
                  format: int32
                amount:
                  type: object
                  description: 该分期计划可用的金额范围。如果为 null，则任意金额均可用。
                  required:
                    - currency
                  properties:
                    currency:
                      type: string
                      description: 用于支付的币种（ISO 4217 MAX 3；MIN 3）
                    min_value:
                      type: number
                      description: 该分期计划可使用的最低金额（0.0001 的倍数）。
                      format: float
                    max_value:
                      type: number
                      description: 该分期计划可使用的最高金额（0.0001 的倍数）。
                      format: float
                availability:
                  type: object
                  description: 该分期计划可用的日期范围。如果为 null，则没有结束日期
                  properties:
                    start_at:
                      type: string
                      description: 该分期计划可开始使用的日期（UTC 格式）
                      format: date-time
                    finish_at:
                      type: string
                      description: 该分期计划可使用至的结束日期（UTC 格式）
                      format: date-time
                payment_method_type:
                  type: string
                  description: >-
                    用于在创建分期计划时指定支付方式类型。`CARD` 按卡 IIN 匹配，`NU_PAY_ENROLLMENT` 和
                    `APPLE_PAY` 则无需 IIN 即可匹配。计划只会提供给其创建时对应的支付方式。
                  enum:
                    - CARD
                    - NU_PAY_ENROLLMENT
                    - APPLE_PAY
            examples:
              Request Example:
                value:
                  name: plan_007
                  account_id:
                    - '{{account-code}}'
                  merchant_reference: Test
                  installments_plan:
                    - installment: 1
                      rate: 1
                    - installment: 3
                      rate: 1
                      financial_costs:
                        - type: CFT
                          rate: 45.25
                        - type: TEA
                          rate: 38.5
                    - installment: 6
                      rate: 1
                    - installment: 9
                      rate: 1
                    - installment: 12
                      rate: 1
                  country_code: CO
                  amount:
                    currency: COP
                    min_value: 0
                    max_value: 100000000
                  availability:
                    start_at: '2023-09-12T00:00:00Z'
                    finish_at: '2030-09-20T00:00:00Z'
                  payment_method_type: NU_PAY_ENROLLMENT
      responses:
        '200':
          description: >-
            目前响应返回的是首字母大写的 `amount.Currency`，而不是
            `amount.currency`。请以不区分大小写的方式读取该键。
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: 4d573425-33f9-4c46-b009-2c7e749b0ec7
                    name: plan_007
                    account_id:
                      - f7c5fe77-721b-49c2-84d3-957748df3c2c
                    merchant_reference: Test
                    installments_plan:
                      - installment: 1
                        rate: 1
                        provider_id: ''
                      - installment: 3
                        rate: 1
                        provider_id: ''
                        financial_costs:
                          - type: CFT
                            rate: 45.25
                            formatted_value: 45,25%
                          - type: TEA
                            rate: 38.5
                            formatted_value: 38,50%
                      - installment: 6
                        rate: 1
                        provider_id: ''
                      - installment: 9
                        rate: 1
                        provider_id: ''
                      - installment: 12
                        rate: 1
                        provider_id: ''
                    source: ''
                    provider_id: ''
                    scheme: ''
                    brand:
                      - VISA
                    issuer: ''
                    issuer_id: ''
                    iin: null
                    country_code: US
                    first_installment_deferral: 0
                    amount:
                      currency: USD
                      min_value: 0
                      max_value: 100000000
                    availability:
                      start_at: '2023-09-12T00:00:00Z'
                      finish_at: '2030-09-20T00:00:00Z'
                    payment_method_type: NU_PAY_ENROLLMENT
                    created_at: '2023-10-11T17:52:31.886178246Z'
                    updated_at: '2023-10-11T17:52:31.886178246Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 4d573425-33f9-4c46-b009-2c7e749b0ec7
                  name:
                    type: string
                    example: plan_007
                  account_id:
                    type: array
                    items:
                      type: string
                      example: f7c5fe77-721b-49c2-84d3-957748df3c2c
                  merchant_reference:
                    type: string
                    example: Test
                  installments_plan:
                    type: array
                    items:
                      type: object
                      properties:
                        installment:
                          type: integer
                          example: 1
                          default: 0
                        rate:
                          type: number
                          example: 1
                          default: 0
                        provider_id:
                          type: string
                          example: ''
                        financial_costs:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - CFT
                                  - TEA
                                  - CET
                                  - CAT
                              rate:
                                type: number
                                format: float
                              formatted_value:
                                type: string
                  type:
                    type: string
                    example: ''
                  source:
                    type: string
                    example: ''
                  provider_id:
                    type: string
                    example: ''
                  scheme:
                    type: string
                    example: ''
                  brand:
                    type: array
                    items:
                      type: string
                      example: VISA
                  issuer:
                    type: string
                    example: ''
                  issuer_id:
                    type: string
                    example: ''
                  iin: {}
                  country_code:
                    type: string
                    example: US
                  first_installment_deferral:
                    type: integer
                    example: 0
                    default: 0
                  amount:
                    type: object
                    properties:
                      currency:
                        type: string
                        example: USD
                      min_value:
                        type: integer
                        example: 0
                        default: 0
                      max_value:
                        type: integer
                        example: 100000000
                        default: 0
                  availability:
                    type: object
                    properties:
                      start_at:
                        type: string
                        example: '2023-09-12T00:00:00Z'
                      finish_at:
                        type: string
                        example: '2030-09-20T00:00:00Z'
                  created_at:
                    type: string
                    example: '2023-10-11T17:52:31.886178246Z'
                  updated_at:
                    type: string
                    example: '2023-10-11T17:52:31.886178246Z'
                  payment_method_type:
                    type: string
                    enum:
                      - CARD
                      - NU_PAY_ENROLLMENT
                      - APPLE_PAY
                    example: NU_PAY_ENROLLMENT
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
              schema:
                type: object
                properties: {}
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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