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

# 更新已支付交易的拆分

> 在服务提供商结算之前，替换已支付交易的 split_marketplace

在支付后重新分配订单的 marketplace（例如由其他卖家交付，或更换了某件商品）可以替换已支付交易的拆分，而无需先退款再重新收费。更新会替换**整个**拆分：您发送的各个分账项将成为新的拆分，未发送的分账项会被移除。支付和交易保持原有状态，也不会创建新交易。

## 何时接受更新

* 交易是状态为 `SUCCEEDED` 的 `PURCHASE`。
* 服务提供商仍然允许更新：在结算之前，且尚未达到服务提供商对每笔交易拆分变更次数的上限（每次更新会为每个分账项各消耗一次额度）。这两个条件均由服务提供商决定；当其中一个条件不满足时，您会收到 `409` 以及 `SPLIT_UPDATE_WINDOW_CLOSED` 或 `SPLIT_UPDATE_LIMIT_REACHED`，拆分不会被更改。Yuno 会统计已进行的变更次数，并在请求到达服务提供商之前拒绝会超出上限的更新。
* 该支付没有退款（部分退款、全额退款或等待重试的退款）、没有拒付，也没有转账冲正。否则，您会收到 `409` 以及 `SPLIT_UPDATE_NOT_ALLOWED`。
* 交易的服务提供商支持此功能。拆分更新仅适用于服务提供商支持的服务提供商与支付方式组合，并且 Yuno 会按环境逐个启用每个组合；请联系 Yuno 启用您的组合。对于未启用的组合，请求会在向服务提供商发送任何内容之前返回 `409` `SPLIT_UPDATE_NOT_ALLOWED`，消息为 "The split of this transaction cannot be updated: the provider and payment method of the transaction do not support it"。

每个分账项都必须指明其收款方（`recipient_id` 或 `provider_recipient_id`，不可同时使用）及其金额。各金额之和不得超过交易金额，并须使用支付的币种。

## 幂等性

`X-Idempotency-Key` 为必填项。**超时并不代表失败**：即使您没有收到响应，更新也可能已在服务提供商处生效。使用**相同的键和相同的请求体**重复发送请求，您将获得第一次尝试的结果，且不会在服务提供商处产生第二次变更：返回相同的状态，以及该支付当前的状态（如果之后又有更新，显示的拆分为当前拆分）。使用相同的键但请求体不同时，请求会被拒绝并返回 `SPLIT_UPDATE_IDEMPOTENCY_CONFLICT`。如果您在第一次尝试仍在运行时重复发送请求（例如在您自己的超时之后立即重试），响应为 `400` `OPERATION_IN_PROCESS`，且不会产生任何变更：请等待几秒钟，然后使用相同的键再次重复该请求。仅在进行新的变更时使用新的键。

## 在何处读取拆分

响应内容为该支付，格式与[按 ID 检索支付](https://docs.y.uno/reference/retrieve-payment-by-id)相同。请在 `transactions.split_marketplace` 上读取拆分；支付层级的 `split_marketplace` 数组不包含该信息。之后的每次 `GET /payments/{payment_id}` 也是如此。

## 当服务提供商未确认时

如果服务提供商未确认结果（服务提供商处超时，或在替换规则时发生故障），响应为 `502` 以及 `PROVIDER_ERROR`，该更新将由 Yuno 进行**审核**。请勿为该交易发送新的更新：在审核完成之前，新的更新会被拒绝并返回 `409` `SPLIT_UPDATE_NOT_ALLOWED`。使用相同的键重试会返回相同的 `502`。在审核完成之前，该支付的退款也会被拒绝（见下一节）。

## 更新未完成期间的退款

当某个支付的更新正在进行或处于审核中时，该支付的退款（包括取消或退款）会被拒绝并返回 `400` `OPERATION_IN_PROCESS`，与该支付上正在运行其他任何操作时的响应相同。处于审核中时，消息会注明这一点。被拒绝的退款不会留下任何记录：更新完成后，请使用**相同的幂等键**重新发送该退款。批量请求的退款不会自动重试；请重新请求。

## 响应代码

| HTTP | `code` | 含义 |
| - | - | - |
| 200 | — | 拆分已被替换。响应内容为该支付。 |
| 400 | `INVALID_PARAMETERS` | 某个字段缺失或无效：缺少幂等键、拆分为空、某个分账项没有收款方或金额、某个分账项同时包含两种收款方 ID、金额超过交易金额、使用其他币种、描述短于 3 个或长于 255 个字符。 |
| 400 | `PAYMENT_NOT_FOUND`、`TRANSACTION_NOT_FOUND` | 在您的账户中找不到该支付，或找不到该支付的该笔交易。 |
| 400 | `OPERATION_IN_PROCESS` | 该支付上已有另一个操作正在运行。请在几秒钟后使用相同的键重试。 |
| 404 | `RECIPIENT_NOT_FOUND` | 某个 `recipient_id` 未知，或该收款方尚未在该交易的服务提供商处完成 onboarding。 |
| 409 | `SPLIT_UPDATE_NOT_ALLOWED` | 该交易不是成功的购买交易、服务提供商未启用、该支付存在退款（包括等待重试的退款）、拒付或转账冲正，或者之前的某次更新正在审核中。 |
| 409 | `SPLIT_UPDATE_WINDOW_CLOSED` | 服务提供商不再接受对该交易的变更。拆分未被更改。 |
| 409 | `SPLIT_UPDATE_LIMIT_REACHED` | 已达到服务提供商对该交易拆分变更次数的上限。拆分未被更改。 |
| 409 | `SPLIT_UPDATE_IN_PROGRESS` | 该交易的另一次更新正在进行中。请在几秒钟后重试。 |
| 409 | `SPLIT_UPDATE_IDEMPOTENCY_CONFLICT` | 该幂等键已用于不同的请求体。 |
| 502 | `PROVIDER_ERROR` | 服务提供商未确认结果；该更新正在审核中。 |


## OpenAPI

````yaml openapi/zh-hans/recipients-for-marketplace/update-split-marketplace.json PUT /payments/{payment_id}/transactions/{transaction_id}/split-marketplace
openapi: 3.1.0
info:
  title: Recipients API
  version: 1.0.0
  description: >-
    Replace the split_marketplace of a transaction that is already paid, before
    the provider settles it.
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /payments/{payment_id}/transactions/{transaction_id}/split-marketplace:
    put:
      summary: 更新已支付交易的拆分
      description: >-
        在提供商处和 Yuno 中，替换已成功的购买交易的整个
        `split_marketplace`。发送的分账项将成为新的拆分；未发送的分账项会被移除。支付和交易保持其状态；不会创建新交易。


        只有在提供商仍然允许时才会接受更新：在结算之前，并且支付没有退款（包括等待重试的退款）、拒付或转账撤销。更新进行中或审核期间，该支付的退款会被拒绝，并返回
        `400` `OPERATION_IN_PROCESS`。可用性取决于提供商；请联系 Yuno 为您的连接启用。
      operationId: update-split-marketplace
      parameters:
        - in: path
          name: payment_id
          schema:
            type: string
          required: true
          description: 支付的唯一标识符（MAX 64；MIN 36）。
        - in: path
          name: transaction_id
          schema:
            type: string
          required: true
          description: 要替换其拆分的购买交易的唯一标识符（最多 64，最少 36）。
        - in: header
          name: X-Idempotency-Key
          schema:
            type: string
          required: true
          description: >-
            必填。此次更新的唯一标识符（最多
            64）。请求超时不代表失败：使用相同的键重复请求，即可获得第一次尝试的结果。相同的键搭配不同的请求体会被拒绝，并返回
            `SPLIT_UPDATE_IDEMPOTENCY_CONFLICT`。在第一次尝试仍在运行时发送的重复请求会返回 `400`
            `OPERATION_IN_PROCESS`，且不会产生任何变更：请等待几秒钟，然后使用相同的键再次重复请求。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - split_marketplace
              properties:
                split_marketplace:
                  type: array
                  minItems: 1
                  description: 新的拆分：更新后交易必须具备的每一个分账项。
                  items:
                    properties:
                      recipient_id:
                        type: string
                        description: >-
                          收款方在 Yuno 系统中的唯一标识符。每个分账项都必须使用
                          [`recipient_id`](/zh-hans/reference/recipients-for-marketplace/create-recipient-1)（由
                          Yuno 生成）或 `provider_recipient_id`（外部提供商的
                          ID）来指定其收款方，不能同时使用两者。
                      provider_recipient_id:
                        type: string
                        description: >-
                          外部支付提供商提供的收款方 ID。每个分账项都必须使用 `provider_recipient_id` 或
                          [`recipient_id`](/zh-hans/reference/recipients-for-marketplace/create-recipient-1)（由
                          Yuno 生成）来指定其收款方，不能同时使用两者。
                      description:
                        type: string
                        description: 拆分的描述。（MAX 255; MIN 3）。
                      type:
                        type: string
                        description: >-
                          拆分的类型。对于 `PURCHASE` 和 `MARKETPLACE`，`recipient_id`
                          为必填项。
                        enum:
                          - PURCHASE
                          - PAYMENTFEE
                          - VAT
                          - COMMISSION
                          - MARKETPLACE
                          - SHIPPING
                      merchant_reference:
                        type: string
                        description: 拆分交易的可选唯一标识符（MAX 255; MIN 3）。
                      recipient_type:
                        type: string
                        description: 服务提供商的收款方类型。
                        enum:
                          - MEAL
                          - FOOD
                          - MULTI_BENEFITS
                          - FLEET
                        example: MEAL
                      amount:
                        type: object
                        description: >-
                          分账项的金额。更新时必填：原始交易的金额不属于此请求，因此不会根据
                          `split_configuration` 计算任何内容。
                        required:
                          - value
                          - currency
                        properties:
                          value:
                            type: number
                            description: 拆分金额（0.0001 的倍数）。
                            format: float
                          currency:
                            type: string
                            description: 支付的币种（最多 3，最少 3；ISO 4217）。可选；省略时使用支付币种。其他币种会被拒绝。
                      liability:
                        type: object
                        description: 关于收款方承担费用和拒付责任的可选信息。
                        properties:
                          processing_fee:
                            type: string
                            description: 表示由谁承担交易手续费。
                            enum:
                              - MERCHANT
                              - RECIPIENT
                              - SHARED
                          chargebacks:
                            type: boolean
                            description: 发生拒付时由收款方负责。
                    required:
                      - type
                      - amount
                    type: object
                description:
                  type: string
                  description: 更新说明（最多 255，最少 3）。
                metadata:
                  type: array
                  description: 随更新一起存储的自定义键值对。
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                      value:
                        type: string
            examples:
              Replace the split with one recipient:
                value:
                  split_marketplace:
                    - provider_recipient_id: 4c036fbdd2a44786815c331e9c011367
                      type: MARKETPLACE
                      amount:
                        value: 6
                        currency: BRL
                  description: Same-day split replacement
                  metadata:
                    - key: reason
                      value: same-day redistribution
      responses:
        '200':
          description: >-
            拆分已被替换。响应是支付对象，格式与[按 ID
            检索支付](/reference/retrieve-payment-by-id)相同；请在
            `transactions.split_marketplace` 中读取新的拆分。
          content:
            application/json:
              schema:
                type: object
                description: 支付对象。参见[支付对象](/zh-hans/reference/payments/the-payment-object)。
              examples:
                Split replaced:
                  value:
                    id: d49f0691-55de-4045-a668-c17f338cd1a3
                    idempotency_key: 496E09AE-D453-491C-9179-9FC1EDEDAD02
                    origin: YUNO
                    account_code: 4be68036-738e-4841-8eb5-7a5927591a1b
                    account_id: 4be68036-738e-4841-8eb5-7a5927591a1b
                    description: pay-test purchase
                    country: BR
                    status: SUCCEEDED
                    sub_status: APPROVED
                    merchant_order_id: pt-1789681395403
                    created_at: '2026-09-17T21:43:16.119879Z'
                    updated_at: '2026-09-17T21:43:18.860706Z'
                    amount:
                      captured: 0
                      currency: BRL
                      currency_conversion: null
                      refunded: 0
                      value: 10
                    checkout:
                      session: ''
                      sdk_action_required: false
                    customer_payer: null
                    additional_data:
                      airline: null
                      transportations: null
                      lodgings: null
                      order: null
                      seller_details: null
                      device: null
                      payer_risk_data: null
                    taxes: null
                    transactions:
                      - id: 77b11fef-5c38-4ecf-9607-015594ee0bc4
                        type: PURCHASE
                        status: SUCCEEDED
                        category: CARD
                        amount: 10
                        provider_id: ZOOP
                        payment_method:
                          vaulted_token: ''
                          type: CARD
                          vault_on_success: false
                          vault_on_decline: false
                          token: ''
                          parent_payment_method_type: null
                          otp:
                            length: 0
                            retries: {}
                          detail:
                            card:
                              verify: false
                              capture: true
                              installments: 1
                              installments_plan_id: null
                              first_installment_deferral: 0
                              installments_type: ''
                              installment_amount: null
                              installments_total_amount: null
                              soft_descriptor: ''
                              authorization_code: '133937'
                              retrieval_reference_number: '20180510122911535'
                              voucher: null
                              card_data:
                                holder_name: YUNO TESTER
                                iin: '42424242'
                                lfd: '4242'
                                number_length: 16
                                security_code_length: 3
                                brand: VISA
                                scheme: VISA
                                issuer_name: STRIPE PAYMENTS UK
                                issuer_code: null
                                country_code: GB
                                category: CLASSIC
                                type: CREDIT
                                three_d_secure:
                                  version: null
                                  electronic_commerce_indicator: null
                                  cryptogram: null
                                  transaction_id: null
                                  directory_server_transaction_id: null
                                  pares_status: null
                                  acs_id: null
                                fingerprint: 4a4c0ff4-6e9e-455d-a104-3e771579a536
                                expiration_month: 3
                                expiration_year: 30
                              stored_credentials: null
                              verification_services:
                                address_line_1_check: UNCHECKED
                                zip_code_check: UNCHECKED
                                card_holder_name_check: UNCHECKED
                                card_security_code_check: UNCHECKED
                        response_code: SUCCEEDED
                        response_message: Transaction successful
                        reason: null
                        description: pay-test purchase
                        merchant_reference: pt-1789681395403
                        provider_data:
                          id: ZOOP
                          transaction_id: af8fd4e75b614591a03b2125b53907a4
                          account_id: ''
                          status: succeeded
                          sub_status: ''
                          status_detail: ''
                          response_message: null
                          response_code: '00'
                          raw_request: >-
                            "{\"payment_type\":\"credit\",\"source\":{\"card\":{\"card_number\":\"a198286a-f433-4603-842b-e7dfc2ec0801\",\"security_code\":\"e2056811-39fc-444a-a355-41aa514c277f\",\"holder_name\":\"YUNO
                            TESTER\",\"expiration_month\":\"3\",\"expiration_year\":\"2030\"},\"usage\":\"single_use\",\"amount\":1000,\"currency\":\"BRL\",\"type\":\"card\"},\"on_behalf_of\":\"4a8418ddc83f4b4fbd6f442902a4e3b3\",\"capture\":true,\"description\":\"pay-test
                            purchase\",\"reference_id\":\"77b11fef-5c38-4ecf-9607-015594ee0bc4\",\"split_rules\":[{\"recipient\":\"3258673725454c5cafaec0210674eb8d\",\"liable\":false,\"charge_processing_fee\":false,\"amount\":600}]}"
                          raw_request_details:
                            headers:
                              Authorization:
                                - '[REDACTED]'
                              X-Account-Integration-Code:
                                - '[REDACTED]'
                              X-Dynamic-Mtls:
                                - '[REDACTED]'
                              x-api-key:
                                - '[REDACTED]'
                            method: POST
                            url: >-
                              /v1/marketplaces/7fcca632f35f4efa8143238d28a89cd9/transactions
                          raw_response_details:
                            http_status_code: 201
                          third_party_transaction_id: ''
                          third_party_account_id: ''
                          iso8583_response_code: null
                          iso8583_response_message: null
                          retrieval_reference_number: null
                          merchant_advice_code: null
                          merchant_advice_code_message: null
                          reason_code: null
                          reason_description: null
                        connection_data:
                          id: 99d88722-2c77-4281-ad92-f74df11bc8b9
                          name: zoop
                        created_at: '2026-09-17T21:43:16.232391Z'
                        updated_at: '2026-09-17T21:43:18.778608Z'
                        split_marketplace:
                          - recipient_id: null
                            recipient_type: null
                            provider_recipient_id: 4c036fbdd2a44786815c331e9c011367
                            type: MARKETPLACE
                            merchant_reference: null
                            amount:
                              value: 6
                              currency: BRL
                            liability: null
                            description: null
                        merchant_advice_code: null
                        merchant_advice_code_message: null
                    split_marketplace: []
                    workflow: DIRECT
                    fraud_screening: null
                    metadata: []
                    shipping: null
                    payment_link_code: ''
                    routing_rules:
                      smart_routing: false
                      monitors: false
                      condition:
                        id: 279053
                        name: null
                        description: null
        '400':
          description: >-
            请求无效，您的账户下找不到该支付或交易，或该支付的另一项操作仍在进行（`OPERATION_IN_PROCESS`，请使用相同的键在几秒后重试）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Legs above the transaction amount:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        Invalid parameters: list - [The split_marketplace
                        amounts add up to more than the transaction amount.]
                Missing idempotency key:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The header 'x-idempotency-key' is required.
                Transaction not found:
                  value:
                    code: TRANSACTION_NOT_FOUND
                    messages:
                      - Transaction of a payment not found.
                Payment not found:
                  value:
                    code: PAYMENT_NOT_FOUND
                    messages:
                      - Payment not found.
                Operation in process:
                  value:
                    code: OPERATION_IN_PROCESS
                    messages:
                      - >-
                        Operation over the same payment is already in process.
                        Try again in a few seconds.
        '404':
          description: 请求中的某个 `recipient_id` 未知，或尚未在该交易的提供商处完成 onboarding。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Recipient not found:
                  value:
                    code: RECIPIENT_NOT_FOUND
                    messages:
                      - >-
                        Recipient not found or not ready for the provider of the
                        transaction: Recipient IDs not found:
                        '11111111-2222-4333-8444-555555555555'
        '409':
          description: 无法更新此交易，或与另一次更新冲突。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Not allowed:
                  value:
                    code: SPLIT_UPDATE_NOT_ALLOWED
                    messages:
                      - >-
                        The split of this transaction cannot be updated: the
                        payment has a refund
                Window closed:
                  value:
                    code: SPLIT_UPDATE_WINDOW_CLOSED
                    messages:
                      - >-
                        The provider no longer accepts split changes for this
                        transaction. The split was not changed.
                Limit reached:
                  value:
                    code: SPLIT_UPDATE_LIMIT_REACHED
                    messages:
                      - >-
                        The provider limit of split changes for this transaction
                        was reached. The split was not changed.
                Update in progress:
                  value:
                    code: SPLIT_UPDATE_IN_PROGRESS
                    messages:
                      - >-
                        Another split update of this transaction is in progress.
                        Try again in a few seconds.
                Idempotency conflict:
                  value:
                    code: SPLIT_UPDATE_IDEMPOTENCY_CONFLICT
                    messages:
                      - >-
                        The idempotency key was already used with a different
                        split update request.
                Under review:
                  value:
                    code: SPLIT_UPDATE_NOT_ALLOWED
                    messages:
                      - >-
                        The split of this transaction cannot be updated: a
                        previous split update of this transaction is under
                        review
        '502':
          description: 提供商未确认结果。该拆分正在由 Yuno 审核；请勿使用新的键重试。使用相同的键重试，在审核完成之前会返回相同的响应。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Provider error:
                  value:
                    code: PROVIDER_ERROR
                    messages:
                      - >-
                        The split update failed at the provider: the split could
                        not be confirmed and is under review
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          example: INVALID_REQUEST
        messages:
          type: array
          items:
            type: string
            example: Invalid request
  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.