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

# 更新计划

> 更新现有分期付款计划的状态、分期详情或支付方式

**Update Plan** API 用于修改现有计划，您可以更新计划的状态、分期详情以及与计划关联的支付方式等属性。

使用此 API 在创建后管理和调整分期付款计划。


## OpenAPI

````yaml openapi/zh-hans/installments/update-plan.json PATCH /installments-plans/{installment_code}
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/{installment_code}:
    patch:
      summary: 更新计划
      operationId: update-plan
      parameters:
        - name: installment_code
          in: path
          description: 分期计划的唯一标识符。
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 分期计划名称（MAX 255；MIN 3）
                account_id:
                  type: array
                  description: 将使用该分期计划的 Yuno 账户的唯一标识符（MAX 64 ; MIN 36）。
                  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
                      - rate
                    type: object
                country_code:
                  type: string
                  description: 发卡机构所在国家（ISO 3166-1，MAX 2；MIN 2）
                scheme:
                  type: string
                  description: 卡组织信息。（MAX 255；MIN 3）
                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，则没有结束日期
                  required:
                    - start_at
                    - finish_at
                  properties:
                    start_at:
                      type: string
                      description: 该分期计划可开始使用的日期
                      format: date-time
                    finish_at:
                      type: string
                      description: 该分期计划可使用至的结束日期。
                      format: date-time
            examples:
              Update Plan:
                summary: Update Plan
                value:
                  name: Plan Update
                  account_id:
                    - '{{account_id}}'
                  merchant_reference: REF01
                  installments_plan:
                    - installment: 3
                      rate: 1.05
                      financial_costs:
                        - type: CFT
                          rate: 15.5
                      type: MERCHANT_INSTALLMENTS
                    - installment: 6
                      rate: 1.1
                    - installment: 12
                      rate: 1.2
                  country_code: US
                  scheme: VISA
                  brand:
                    - VISA
                    - MASTERCARD
                  issuer: JPMORGAN CHASE BANK
                  iin:
                    - '411111'
                    - '542418'
                  first_installment_deferral: 1
                  amount:
                    currency: USD
                    min_value: 50
                    max_value: 10000
                  availability:
                    start_at: '2024-01-01T00:00:00.000Z'
                    finish_at: '2024-12-31T23:59:59.999Z'
      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'
                    created_at: '2023-10-11T17:52:31.886178246Z'
                    updated_at: '2023-10-11T17:52:31.886178246Z'
                    payment_method_type: NU_PAY_ENROLLMENT
              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
                    example: NU_PAY_ENROLLMENT
                    description: 支付方式类型。
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: {}
              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.