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

# 处理预拒付警报

> 告知 Yuno（并通过 Yuno 告知警报网络）您对 Ethoca 或 Verifi 预拒付警报的处理方式。

当 Ethoca 或 Verifi 警报与您的某笔支付匹配时，Yuno 会添加一笔类型为 `PRE_CHARGEBACK`、状态为 `PENDING_REVIEW` 的交易，并向您发送包含警报 `deadline` 的 webhook。请在该截止时间之前调用此 endpoint 来报告您的处理结果。完整流程请参阅[预拒付警报](https://docs.y.uno/zh-hans/docs/payouts-and-disputes/chargeback-management.md#pre-chargeback-alerts-ethoca-and-verifi)。

交易必须为 `PRE_CHARGEBACK` 类型且处于 `PENDING_REVIEW` 状态。否则 API 会返回 400 `INVALID_TRANSACTION_TYPE` 或 `INVALID_STATUS`。

> [!NOTE]
>
> **处理结果**
>
> | `reason` | 适用情况 | Yuno 的操作 |
> | - | - | - |
> | `REFUNDED` | 您将款项退还给持卡人 | 对警报金额中尚未退款的部分进行退款，然后向网络返回响应。在退款确认之前，交易保持 `PENDING_REVIEW` 状态。重复调用不会重复退款 |
> | `RESOLVED` | 您未通过退款即已处理 | 向网络返回响应 |
> | `CANCELLED` | 授权或订单已取消 | 向网络返回响应 |
> | `ORDER_STOPPED` | 适用于欺诈警报：您已停止该订单 | 向网络返回响应，并暂停该支付关联的订阅 |
> | `SERVICE_SUSPENDED` | 适用于欺诈警报：您已暂停服务 | 向网络返回响应，并暂停该支付关联的订阅 |
> | `DISMISS` | 您驳回该警报 | 向网络返回响应。当该支付上没有其他未关闭的警报时，因该支付上的警报而暂停的订阅会恢复 |
>
> 其他任何值都会被拒绝，并返回 400 `INVALID_RESOLUTION`。您也可以在可选的 `resolution` 字段中发送处理结果，该字段接受相同的值，两者同时存在时优先于 `reason`。请将 `status` 发送为 `SETTLED`。

> [!NOTE]
>
> **您可能无需调用此 endpoint**
>
> * 通过[退款 endpoint](https://docs.y.uno/zh-hans/reference/payments/refund-payment.md) 进行的退款如果覆盖了警报金额，会以 `REFUNDED` 关闭警报，并替您向网络返回响应。
> * 如果警报到达时支付已全额退款，Yuno 会在警报到达后立即将其关闭。
> * 如果无人处理，Yuno 会在截止时间前不久向网络返回响应。如果已确认的退款覆盖了该警报，Yuno 返回 `REFUNDED`，交易变为 `SUCCEEDED`。否则（包括退款失败或部分退款），Yuno 返回 `MISSED`，交易变为 `EXPIRED`。
> * 截止时间时仍处于待处理状态的退款会使警报在 `PENDING_REVIEW` 中保持未关闭，Yuno 不会发送任何内容。

> [!WARNING]
>
> 预拒付警报仅存在于生产环境中。目前 sandbox 中没有可触发它们的方式。

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


## OpenAPI

````yaml openapi/zh-hans/payments/settle-pre-chargeback.json POST /payments/{payment_id}/transactions/{transaction_id}/settle
openapi: 3.1.0
info:
  title: payment-api-settle-pre-chargeback
  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}/settle:
    post:
      summary: 处理预拒付警报
      description: >-
        记录您对 Ethoca 或 Verifi 预拒付警报的处理结果，并将其转发给警报网络。交易的类型必须为 PRE_CHARGEBACK，且状态为
        PENDING_REVIEW。原因为 REFUNDED 时，Yuno 会先退还警报金额中尚未退款的部分，因此您无需另外调用退款。
      operationId: settlePreChargeback
      parameters:
        - name: payment_id
          in: path
          required: true
          description: 支付的唯一标识符（UUID，36 个字符）。
          schema:
            type: string
        - name: transaction_id
          in: path
          required: true
          description: >-
            警报所创建的 PRE_CHARGEBACK 交易的 id（UUID，36 个字符）。API 将此路径参数称为
            transaction_code。
          schema:
            type: string
        - name: X-Idempotency-Key
          in: header
          required: true
          description: 在 HTTP 标头中使用的唯一标识符，用于确保请求只被处理一次，即使因网络问题或超时而重试。
          schema:
            type: string
            example: f47ac10b-58cc-4372-a567-0e02b2c3d479
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - description
                - status
                - reason
                - merchant_reference
              properties:
                reason:
                  type: string
                  description: >-
                    您对警报的处理结果。REFUNDED：全额退款（Yuno
                    会发起缺少的退款）。RESOLVED：未退款即已处理。CANCELLED：授权或订单已取消。ORDER_STOPPED
                    和 SERVICE_SUSPENDED：用于欺诈警报，并会暂停该支付背后的订阅。DISMISS：您拒绝该警报。
                  enum:
                    - REFUNDED
                    - RESOLVED
                    - CANCELLED
                    - ORDER_STOPPED
                    - SERVICE_SUSPENDED
                    - DISMISS
                resolution:
                  type: string
                  description: 可选。与 reason 的值相同。发送后，Yuno 会将其作为结果，而不是 reason。
                  enum:
                    - REFUNDED
                    - RESOLVED
                    - CANCELLED
                    - ORDER_STOPPED
                    - SERVICE_SUSPENDED
                    - DISMISS
                status:
                  type: string
                  description: 您是否已处理该警报。
                  enum:
                    - SETTLED
                    - NOT_SETTLED
                description:
                  type: string
                  description: 描述您所做操作的自由文本。
                merchant_reference:
                  type: string
                  description: 您为此答复设置的参考信息，例如您的案件 id。
            examples:
              Refund and settle:
                value:
                  reason: REFUNDED
                  status: SETTLED
                  description: Refunded after Ethoca alert
                  merchant_reference: case-48211
      responses:
        '201':
          description: 结果已记录并发送给警报网络。响应描述 PRE_CHARGEBACK 交易及其支付。
          content:
            application/json:
              schema:
                type: object
                description: 您答复之后的 PRE_CHARGEBACK 交易。可为空的字段始终存在，并以 null 返回。
                properties:
                  code:
                    type: string
                    description: PRE_CHARGEBACK 交易 id。
                  type:
                    type: string
                    description: 始终为 PRE_CHARGEBACK。
                  status:
                    type: string
                    description: >-
                      交易状态。使用 REFUNDED 时，在退款确认之前为
                      PENDING_REVIEW，即处理时发起了退款或仍有一笔退款在处理中。否则为您发送的状态（SETTLED）。
                  reason:
                    type:
                      - string
                      - 'null'
                    description: 您发送的原因。
                  merchant_reference:
                    type: string
                    description: 您发送的 merchant_reference。
                  response_code:
                    type:
                      - string
                      - 'null'
                    description: 响应代码。
                  response_message:
                    type:
                      - string
                      - 'null'
                    description: 响应消息。
                  resolution:
                    type:
                      - string
                      - 'null'
                    description: >-
                      警报上记录的结果。当 REFUNDED 处理发起了退款或在等待处理中的退款时为 null；此时结果位于 reason
                      中。
                  category:
                    type: string
                    description: 支付方式类别，例如 CARD。
                  amount:
                    type: object
                    properties:
                      value:
                        type: number
                        description: 金额。
                      captured:
                        type:
                          - number
                          - 'null'
                        description: 已捕获金额。
                      refunded:
                        type:
                          - number
                          - 'null'
                        description: 已退款金额。
                      currency:
                        type: string
                        description: ISO 4217 货币代码。
                    description: 警报金额。
                  provider_data:
                    type: object
                    description: 警报网络数据。
                    properties:
                      id:
                        type: string
                        description: 警报网络，ETHOCA 或 VERIFI。
                      transaction_id:
                        type: string
                        description: 网络的警报 id。
                      account_id:
                        type: string
                        description: 服务提供商账户 id。
                      status:
                        type:
                          - string
                          - 'null'
                        description: 服务提供商状态。
                      status_detail:
                        type:
                          - string
                          - 'null'
                        description: 服务提供商状态详情。
                      raw_response:
                        type:
                          - object
                          - 'null'
                        properties:
                          detail:
                            type: string
                            description: 详情。
                          timestamp:
                            type: string
                            description: 时间戳。
                  payment:
                    type: object
                    description: 警报匹配到的支付。
                    properties:
                      code:
                        type: string
                        description: 支付 id。
                      account_id:
                        type: string
                        description: 账户 id。
                      account_code:
                        type: string
                        description: 与 account_id 的值相同。
                      description:
                        type:
                          - string
                          - 'null'
                        description: 支付描述。
                      country:
                        type: string
                        description: 国家/地区代码。
                      status:
                        type: string
                        description: 支付状态。
                      merchant_order_id:
                        type: string
                        description: 您的订单 id。
                      created_at:
                        type: string
                        description: 创建时间。
                        format: date-time
                      updated_at:
                        type: string
                        description: 最近更新时间。
                        format: date-time
                      amount:
                        type: object
                        properties:
                          value:
                            type: number
                            description: 金额。
                          captured:
                            type:
                              - number
                              - 'null'
                            description: 已捕获金额。
                          refunded:
                            type:
                              - number
                              - 'null'
                            description: 已退款金额。
                          currency:
                            type: string
                            description: ISO 4217 货币代码。
                        description: 支付金额。
                  created_at:
                    type: string
                    description: 创建时间。
                    format: date-time
                  updated_at:
                    type: string
                    description: 最近更新时间。
                    format: date-time
              examples:
                Success:
                  value:
                    code: 9a3c1f62-2b7e-4d41-8f0e-4c6d2a91b7e5
                    type: PRE_CHARGEBACK
                    status: PENDING_REVIEW
                    reason: REFUNDED
                    merchant_reference: case-48211
                    response_code: PENDING
                    response_message: Notification pre chargeback
                    resolution: null
                    category: CARD
                    amount:
                      value: 29.9
                      captured: null
                      refunded: null
                      currency: EUR
                    provider_data:
                      id: ETHOCA
                      transaction_id: ALERT_ID
                      account_id: ''
                      status: null
                      status_detail: null
                      raw_response: null
                    payment:
                      code: 4f1d2c7a-8b3e-4a5f-9c6d-2e1b0a9f8c7d
                      account_id: 7c2e9d14-5a6b-4c3d-8e2f-1a0b9c8d7e6f
                      account_code: 7c2e9d14-5a6b-4c3d-8e2f-1a0b9c8d7e6f
                      description: Annual plan
                      country: ES
                      status: SUCCEEDED
                      merchant_order_id: order-77310
                      created_at: '2026-11-18T10:02:44Z'
                      updated_at: '2026-11-20T15:40:11Z'
                      amount:
                        value: 29.9
                        captured: 29.9
                        refunded: 0
                        currency: EUR
                    created_at: '2026-11-20T09:12:03Z'
                    updated_at: '2026-11-20T15:40:11Z'
        '400':
          description: >-
            请求被拒绝。代码：INVALID_PARAMETERS（payment_id 或 transaction_id 不是 UUID
            v4）、INVALID_RESOLUTION（结果不在列表中；消息中列出了允许的值）、INVALID_TRANSACTION_TYPE（不是
            PRE_CHARGEBACK）、INVALID_STATUS（该警报并未在等待处理结果）、TRANSACTION_NOT_FOUND、SETTLE_FAILED（警报网络未接受该答复）、SETTLE_REFUND_INSUFFICIENT_BALANCE、SETTLE_REFUND_CURRENCY_MISMATCH（警报使用的货币与支付不同，因此不会发起退款）、SETTLE_REFUND_FAILED。
          content:
            application/json:
              examples:
                Invalid outcome:
                  value:
                    code: INVALID_RESOLUTION
                    messages:
                      - >-
                        Invalid resolution. Allowed values: RESOLVED, REFUNDED,
                        CANCELLED, ORDER_STOPPED, SERVICE_SUSPENDED, DISMISS.
        '401':
          description: 缺少凭证或凭证无效。
        '403':
          description: OPERATION_NOT_ALLOWED_FOR_REPORTED_PAYMENT：该支付为已上报的支付。
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.