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

# 增量授权

> 按差额提高现有授权的冻结金额，而无需创建新的授权。

此请求用于提高先前已授权支付的金额（增量授权）。它专为金额不确定的场景设计（电动汽车充电、加油、酒店住宿、租车），在这些场景中，您先授权一笔小额金额，随着最终金额逐渐明确再提高冻结金额，然后通过[捕获 API](https://docs.y.uno/zh-hans/reference/payments/capture-authorization.md) 一次性捕获。

您发送的 `amount` 是一个**差额**：即要在当前已授权金额基础上增加的金额。Yuno 会将其转换为各服务提供商所需的语义。

每次增量都会创建一笔独立的 `AUTHORIZE_INCREMENT` 交易，并带有该次增量的结果，可在[按 ID 检索支付](https://docs.y.uno/zh-hans/reference/payments/retrieve-payment-by-id-v2.md)中查看。增量通过 `payment.authorize` [webhook 事件](https://docs.y.uno/zh-hans/docs/webhooks/events.md)通知，因此请订阅 `AUTHORIZE` 触发器来接收；没有单独的增量事件。成功的增量会提高 `payment.amount.authorized`；`payment.amount.value` 保留原始金额。已拒绝的增量不会改变先前已授权的金额。同一授权上可以执行多次增量，但必须按顺序进行：如果上一次增量仍在处理中时请求新的增量，将返回 `400`。

请注意，此请求需要 `X-Idempotency-Key`。如需了解更多信息，请查看[身份验证](https://docs.y.uno/zh-hans/reference/getting-started/authentication.md#idempotency)页面。

## 增量后的捕获

显式指定 `amount` 的[捕获](https://docs.y.uno/zh-hans/reference/payments/capture-authorization.md)可以结算不超过当前授权总额（原始授权加上所有成功的增量）的任意金额。**不带金额**的捕获会结算该交易当前的全部冻结金额，即原始授权金额加上该交易上所有 `SUCCEEDED` 的增量。捕获时仍处于 `PENDING` 状态的增量不包括在内。

> [!WARNING]
>
> **原始授权必须选择启用**
>
> 部分服务提供商只允许对以预授权冻结方式创建的授权进行增量。请在[创建支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md)时设置 `authorization_type: "PRE_AUTHORIZATION"`（同时设置 `capture: false`）；请参阅[取消与捕获流程](https://docs.y.uno/zh-hans/docs/payment-features/Cancel-and-capture-flow.md#pre-authorization-holds-authorization_type)指南。当服务提供商拒绝增量时（原因是原始授权不是预授权，或者超出了服务提供商的增量限制，例如超过 10 次增量，或总额超过初始金额的 5 倍），增量交易会返回 `AUTHORIZATION_NOT_INCREMENTABLE` 响应代码。

## 服务提供商支持

支持情况取决于服务提供商。如果为该支付路由的服务提供商不支持增量授权，调用仍会返回 `201`，但增量交易的 `status` 为 `ERROR`，`response_code` 为 `OPERATION_NOT_SUPPORTED_BY_PROVIDER`。这不是 HTTP 错误，因此请根据交易的 `status` 而不是 HTTP 状态码进行分支处理。先前已授权的金额保持不变。

**Revolut** 是目前唯一支持增量授权的服务提供商。

| 服务提供商 | 结果 | 备注 |
| - | - | - |
| Revolut | 异步 | 交易以 `PENDING` 返回；最终结果通过 `payment.authorize` webhook 传递。增量要求原始授权以 `authorization_type: "PRE_AUTHORIZATION"` 创建，仅适用于卡、Apple Pay 和 Google Pay，只能在生产环境中测试（sandbox 中不可用），并且最多可进行 10 次顺序增量，总额最高为初始金额的 5 倍 |

其他服务提供商（Stripe、Adyen、Checkout.com、CyberSource）已列入路线图，但尚不可用；目前在这些服务提供商上调用该 endpoint 会返回上文所述的 `OPERATION_NOT_SUPPORTED_BY_PROVIDER` 交易。


## OpenAPI

````yaml openapi/zh-hans/payments/increment-authorization.json POST /payments/{payment_id}/transactions/{transaction_id}/increment
openapi: 3.1.0
info:
  title: payment-api-increment-authorization
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
    sec2: []
paths:
  /payments/{payment_id}/transactions/{transaction_id}/increment:
    post:
      summary: 增加授权金额
      description: 按增量金额提高现有的授权冻结。每次增加都会创建各自的 `AUTHORIZE_INCREMENT` 交易，并有单独的增量结果。
      operationId: increment-authorization
      parameters:
        - name: payment_id
          in: path
          description: 支付的唯一标识符（UUID，36 个字符）。
          schema:
            type: string
          required: true
        - name: transaction_id
          in: path
          description: 要增加金额的原始 AUTHORIZE 交易的唯一标识符（UUID，36 个字符）。
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
                - merchant_reference
              properties:
                amount:
                  type: object
                  description: 要在当前已授权金额基础上增加的金额（增量，而非新的总额）。货币必须与原授权一致。
                  required:
                    - value
                    - currency
                  properties:
                    value:
                      type: number
                      description: 要在当前已授权金额基础上增加的增量。
                      example: 50
                    currency:
                      type: string
                      description: 三个字母的 ISO 4217 货币代码。必须与原授权一致。
                      example: EUR
                merchant_reference:
                  type: string
                  description: 此次增加的参考信息。
                description:
                  type: string
                  description: 此次增加的可选描述。
            examples:
              Increment by 50:
                value:
                  amount:
                    value: 50
                    currency: EUR
                  merchant_reference: session-8842-inc-2
                  description: EV charging session top-up
      responses:
        '201':
          description: '201'
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 增加交易的唯一标识符（UUID）。
                  type:
                    type: string
                    description: 交易类型。
                    example: AUTHORIZE_INCREMENT
                  status:
                    type: string
                    enum:
                      - SUCCEEDED
                      - DECLINED
                      - PENDING
                      - ERROR
                    description: >-
                      每次增加的结果。`SUCCEEDED`：冻结金额已提高。`DECLINED`：发卡机构或服务提供商拒绝了本次增加，之前的已授权金额保持不变。`PENDING`：服务提供商以异步方式处理增加，最终结果通过
                      webhook 送达。`ERROR`：无法处理本次增加。
                  amount:
                    type: object
                    description: 本次增加所增加的增量。
                    properties:
                      value:
                        type: number
                        example: 50
                      currency:
                        type: string
                        example: EUR
                  merchant_reference:
                    type: string
                    description: 请求中发送的参考信息。
                  parent_transaction_id:
                    type: string
                    description: 本次增加所属的原始 AUTHORIZE 交易的 `transaction_id`。
                  response_code:
                    type: string
                    description: >-
                      本次增加的 Yuno 响应代码：服务提供商返回子状态时为交易子状态，否则为交易状态（例如
                      `SUCCEEDED`、`PENDING_PROVIDER_CONFIRMATION`、`AUTHORIZATION_NOT_INCREMENTABLE`）。它不是
                      ISO 8583 发卡机构代码。`AUTHORIZATION_NOT_INCREMENTABLE`
                      表示服务提供商拒绝了本次增加：原授权并非以 `PRE_AUTHORIZATION`
                      创建，或者超出了服务提供商的增加限制（例如在 Revolut 上超过 10 次增加，或总额超过初始金额的 5 倍）。
                  response_message:
                    type: string
                    description: 结果的可读详情。
                  provider_data:
                    type: object
                    description: 本次增加的服务提供商原始标识符和状态。
                  payment:
                    type: object
                    description: 本次增加之后的父支付。
                    properties:
                      id:
                        type: string
                        description: 支付的唯一标识符（UUID）。
                      status:
                        type: string
                        example: AUTHORIZED
                      amount:
                        type: object
                        description: 父支付的金额。增加不会改变 `value`，而是提高 `authorized`。
                        properties:
                          value:
                            type: number
                            description: 原始支付金额。不会因增加而改变。
                            example: 100
                          authorized:
                            type: number
                            description: >-
                              已授权总额：原授权加上所有 `SUCCEEDED`
                              的增加。当服务提供商以异步方式处理增加时（Revolut），增加在此响应中仍为
                              `PENDING`，因此 `authorized` 尚不包含它；增加成功后才会反映提高后的总额。
                            example: 150
                          currency:
                            type: string
                            example: EUR
              examples:
                Approved Increment:
                  value:
                    id: 8f2f4bce-1d2f-4f6e-9a3b-0c1e5d3a7b21
                    type: AUTHORIZE_INCREMENT
                    status: SUCCEEDED
                    amount:
                      value: 50
                      currency: EUR
                    merchant_reference: session-8842-inc-2
                    parent_transaction_id: 1a71c7b7-80c2-4ba5-b601-4d34d48c0e18
                    response_code: SUCCEEDED
                    response_message: Approved
                    provider_data:
                      id: prov-ref-001
                      status: ...
                    payment:
                      id: d19205be-1a70-4c13-a4e6-8b7a9f3e2c11
                      status: PENDING
                      sub_status: AUTHORIZED
                      amount:
                        value: 100
                        authorized: 150
                        currency: EUR
                Pending Increment (async provider):
                  value:
                    id: 8f2f4bce-1d2f-4f6e-9a3b-0c1e5d3a7b21
                    type: AUTHORIZE_INCREMENT
                    status: PENDING
                    amount:
                      value: 50
                      currency: EUR
                    merchant_reference: session-8842-inc-2
                    parent_transaction_id: 1a71c7b7-80c2-4ba5-b601-4d34d48c0e18
                    response_code: PENDING_PROVIDER_CONFIRMATION
                    response_message: Increment in progress; final result delivered via webhook
                    provider_data:
                      id: prov-ref-001
                      status: ...
                    payment:
                      id: d19205be-1a70-4c13-a4e6-8b7a9f3e2c11
                      status: PENDING
                      sub_status: AUTHORIZED
                      amount:
                        value: 100
                        authorized: 100
                        currency: EUR
                Declined Increment:
                  value:
                    id: 8f2f4bce-1d2f-4f6e-9a3b-0c1e5d3a7b21
                    type: AUTHORIZE_INCREMENT
                    status: DECLINED
                    amount:
                      value: 50
                      currency: EUR
                    merchant_reference: session-8842-inc-2
                    parent_transaction_id: 1a71c7b7-80c2-4ba5-b601-4d34d48c0e18
                    response_code: DECLINED
                    response_message: Insufficient funds
                    provider_data:
                      id: prov-ref-001
                      status: ...
                    payment:
                      id: d19205be-1a70-4c13-a4e6-8b7a9f3e2c11
                      status: PENDING
                      sub_status: AUTHORIZED
                      amount:
                        value: 100
                        authorized: 100
                        currency: EUR
                Not Incrementable:
                  value:
                    id: 8f2f4bce-1d2f-4f6e-9a3b-0c1e5d3a7b21
                    type: AUTHORIZE_INCREMENT
                    status: DECLINED
                    amount:
                      value: 50
                      currency: EUR
                    merchant_reference: session-8842-inc-2
                    parent_transaction_id: 1a71c7b7-80c2-4ba5-b601-4d34d48c0e18
                    response_code: AUTHORIZATION_NOT_INCREMENTABLE
                    response_message: >-
                      The provider rejected the increment (not a
                      pre-authorization, or the provider's increment limits were
                      exceeded)
                    provider_data:
                      id: prov-ref-001
                      status: ...
                    payment:
                      id: d19205be-1a70-4c13-a4e6-8b7a9f3e2c11
                      status: PENDING
                      sub_status: AUTHORIZED
                      amount:
                        value: 100
                        authorized: 100
                        currency: EUR
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Invalid request:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
                Payment or transaction not found:
                  value:
                    code: TRANSACTION_NOT_FOUND
                    messages:
                      - Payment or transaction not found
                Transaction not an active authorization:
                  value:
                    code: INVALID_STATUS_WITH_FORMAT
                    messages:
                      - >-
                        The payment is not in an authorized hold state, the
                        authorization is not SUCCEEDED (already captured,
                        voided, or expired), or another increment is already in
                        progress
                Currency mismatch:
                  value:
                    code: INVALID_CURRENCY
                    messages:
                      - Currency does not match the original authorization
                Target transaction is not an authorization:
                  value:
                    code: INVALID_TRANSACTION_TYPE
                    messages:
                      - >-
                        The target transaction is not an AUTHORIZE transaction.
                        Use the transaction_id of the original authorization,
                        not a capture or purchase transaction.
                Invalid amount:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        Invalid amount. The increment amount (delta) must be
                        greater than zero.
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: UNAUTHORIZED
                    messages:
                      - Invalid credentials
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: FORBIDDEN
                    messages:
                      - Forbidden
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      x-default: <Your public-api-key>
      name: public-api-key
    sec1:
      type: apiKey
      in: header
      x-default: <Your private-secret-key>
      name: private-secret-key
    sec2:
      type: apiKey
      in: header
      x-default: <Your X-Idempotency-Key>
      name: X-Idempotency-Key

````

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