> ## 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 允许您将支付总额拆分为各个组成部分，例如基础费用、税费、手续费、小费和折扣。

* [手续费](#fee-amount)
* [运费](#shipping-amount)
* [小费](#tips)
* [税费](#taxes)
* [折扣](#discounts)
* [客户验证](#customer-validations)

这些字段仅供参考：每个组成部分都已包含在支付总额 `amount.value` 中，不会在其基础上额外叠加。唯一的例外是 `YUNO_PROMOTION` 折扣：您发送原始 `amount`，Yuno 按 `amount.value` 减去该折扣后的金额收费（请参阅[折扣](#discounts)）。

## 手续费金额

专用字段（`additional_data.order.fee_amount`）可让您指定交易中包含的服务手续费金额。

在以下示例中，您可以看到一个请求，说明 180 JPY 的手续费金额是 5000 JPY 最终交易金额的一部分。此字段仅供参考，`fee_amount` 已包含在最终交易金额中，不会单独添加。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
     --url https://api-sandbox.y.uno/v1/payments \
     --header 'X-Idempotency-Key: <Your idempotency-key>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>' \
     --data '
{
    "description": "Test",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "JP",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "JPY",
        "value": 5000.00
    },
    "customer_payer": {
        "id":"967ecd18-d898-4b88-9400-dd5b01b18edc"
    },
    "additional_data": {
          "order": {
              "fee_amount": 180.00
          }
      },
    "workflow": "DIRECT",
    "payment_method": {
        "type":"CARD",
        "vaulted_token": "eb8caa17-6407-457b-960e-125d8d7a90c1",
        "detail": {
           "card": {
               "stored_credentials":{
                  "reason":"CARD_ON_FILE",
                  "usage": "USED"
              }
           }
        }
    }
}
'
```

## 运费金额

专用字段（`additional_data.order.shipping_amount`）可让您指定交易中包含的运费金额。

在以下示例中，您可以看到一个请求，说明 270 JPY 的运费金额是 5000 JPY 最终交易金额的一部分。此字段仅供参考，`shipping_amount` 已包含在最终交易金额中，不会单独添加。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
     --url https://api-sandbox.y.uno/v1/payments \
     --header 'X-Idempotency-Key: <Your idempotency-key>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>' \
     --data '
{
    "description": "Test",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "JP",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "JPY",
        "value": 5000.00
    },
    "customer_payer": {
        "id":"967ecd18-d898-4b88-9400-dd5b01b18edc"
    },
    "additional_data": {
          "order": {
              "shipping_amount": 270.00
          }
      },
    "workflow": "DIRECT",
    "payment_method": {
        "type":"CARD",
        "vaulted_token": "eb8caa17-6407-457b-960e-125d8d7a90c1",
        "detail": {
           "card": {
               "stored_credentials":{
                  "reason":"CARD_ON_FILE",
                  "usage": "USED"
              }
           }
        }
    }
}
'
```

## 小费

专用字段（`additional_data.order.tip_amount`）可让您指定交易中包含的小费金额。

在以下示例中，您可以看到一个请求，说明 50 JPY 的小费金额是 5000 JPY 最终交易金额的一部分。此字段仅供参考，`tip_amount` 已包含在最终交易金额中，不会单独添加。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
     --url https://api-sandbox.y.uno/v1/payments \
     --header 'X-Idempotency-Key: <Your idempotency-key>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>' \
     --data '
{
    "description": "Test",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "JP",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "JPY",
        "value": 5000.00
    },
    "customer_payer": {
        "id":"967ecd18-d898-4b88-9400-dd5b01b18edc"
    },
    "additional_data": {
          "order": {
              "tip_amount": 50.00
          }
      },
    "workflow": "DIRECT",
    "payment_method": {
        "type":"CARD",
        "vaulted_token": "eb8caa17-6407-457b-960e-125d8d7a90c1",
        "detail": {
           "card": {
               "stored_credentials":{
                  "reason":"CARD_ON_FILE",
                  "usage": "USED"
              }
           }
        }
    }
}
'
```

## 税费

专用对象数组（`additional_data.order.taxes`）可让您指定交易中包含的服务税费金额。

| 字段 | 类型 | 描述 | 示例 |
| :- | :- | :- | :- |
| type\* | enum | 税种。 | VAT |
| tax\_base | float | 支付的计税基础金额。 | 10000.00 |
| value\* | float | 支付的税额。 | 2100.00 |
| percentage | float | 税率 | 21.00 |

| 税种 | 适用国家 | 描述 |
| :- | :- | :- |
| VAT | COL, ECU | 增值税（Value Added Tax），也称为 IVA。 |
| CONSUMPTION\_TAX | COL | 也称为“Impuesto al consumo”。在哥伦比亚，国家消费税是一种间接税，适用于特定商品和服务的销售，例如酒精饮料、香烟、移动电话服务等。税率因商品或服务而异。 |
| AIRPORT\_TAX | COL, BRL | 此税是向乘客收取的机场设施使用费。该税因机场而异，可能包括国内和国际费率。 |
| VAT\_LAW\_17934 | UYU | 在乌拉圭，第 17.934 号法律是指对增值税（VAT）作出具体修改和规定的法规。该法律可能包括关于免税、特殊税率和行政程序的规定。 |
| VAT\_LAW\_19210 | UYU | 在乌拉圭，第 19.210 号法律对 VAT 规则作出了额外的规定或修改。该法律可能侧重于税务流程数字化、新税率，或某些商品和服务的免税及税务处理调整等方面。 |
| VAT\_EXEMPTION | COL, ECU | 增值税豁免 |
| ISV | DOM | 销售税。也称为“Impuesto Sobre las Ventas”。在多米尼加共和国，ISV 通常称为 ITBIS（Impuesto a la Transferencia de Bienes Industrializados y Servicios），是一种对商品和服务转让征收的增值税。ITBIS 类似于其他国家的 VAT，在生产和分销过程的每个环节征收。 |

在以下示例中，您可以看到一个请求，说明哪些税费是 1000.00 USD 最终交易金额的一部分。此字段仅供参考；`taxes` 结构已包含在最终交易金额中，未单独添加。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
     --url https://api-sandbox.y.uno/v1/payments \
     --header 'X-Idempotency-Key: <Your idempotency-key>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>' \
     --data '
{
    "description": "Test",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "US",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "USD",
        "value": 1000.00
    },
    "customer_payer": {
        "id":"967ecd18-d898-4b88-9400-dd5b01b18edc"
    },
    "additional_data": {
          "order": {
              "taxes": [
                {
                  "type": "AIRPORT_TAX",
                  "tax_base":400000.00
                },
                {
                  "type": "VAT",
                  "value": 320000.00,
                  "tax_base":2000000.00
                }
              ]
          }
      },
    "workflow": "DIRECT",
    "payment_method": {
        "type":"CARD",
        "vaulted_token": "eb8caa17-6407-457b-960e-125d8d7a90c1",
        "detail": {
           "card": {
               "stored_credentials":{
                  "reason":"CARD_ON_FILE",
                  "usage": "USED"
              }
           }
        }
    }
}
'
```

## 折扣

专用对象数组（`additional_data.order.discounts`）可让您指定交易中包含的折扣。

每一行都有一个 `type`。`MERCHANT`（默认值）是您自行计算的折扣：`id`、`name` 和 `unit_amount` 为必填项，且 `id` 和 `name` 的长度为 3 到 255 个字符。`YUNO_PROMOTION` 是由 Yuno 计算的[促销](https://docs.y.uno/zh-hans/docs/payment-features/promotions)。该行携带促销报价的 `quote_id` 或 `code`，二者不能同时携带，并且会拒绝 `id`、`name` 和 `unit_amount`。既不携带 `quote_id` 也不携带 `code` 的 `YUNO_PROMOTION` 行会返回 `400`。`MERCHANT` 行会拒绝 `quote_id`，任何混用都会返回 `400 INVALID_PARAMETERS`。`MERCHANT` 行上的 `code` 会被忽略且不报错，也不会应用任何促销。没有 `type` 的行，如果携带 `quote_id`，或者携带 `code` 且没有 `id` 或 `name`，会被视为 `YUNO_PROMOTION`；其他没有 `type` 的行都是 `MERCHANT` 行。请完全按所示的大写形式填写 `type`：任何其他写法都会返回 `400`。每笔支付只能有一条 `YUNO_PROMOTION` 行，无论其携带的是报价还是促销码，且折扣行总数最多为 10 条。携带 `quote_id` 或 `code` 的 `YUNO_PROMOTION` 行仅在创建支付时被接受：多支付方式支付、支付链接、结账会话和捕获会以 `400` 拒绝该行，而携带 `subscription` 或 `external_subscription` 的支付会以 `422 PROMOTION_SUBSCRIPTION_UNSUPPORTED` 拒绝该行。

要兑换促销码，请在该行上发送促销码，而不是 `quote_id`：`{ "code": "SUMMER10" }`。促销码长度为 3 到 32 个字符：字母、数字、`-` 和 `_`。Yuno 会去除其前后的空格。在以下情况下，该行会返回 `400 INVALID_PARAMETERS`，且不会创建支付：`code` 为空或格式不符；该行同时带有 `quote_id`；该行同时带有 `unit_amount`；`type: YUNO_PROMOTION` 的行同时带有 `id` 或 `name`；支付中存在第二条 `YUNO_PROMOTION` 行。使用 `X-Dry-Run: true` 发送、且在 `YUNO_PROMOTION` 行上携带 `code` 的支付也会以 `400 INVALID_PARAMETERS` 被拒绝：试运行不接受促销码，因此请在 sandbox 中测试促销码。[创建支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md#promotion-codes)列出了每条规则对应的消息，[促销码](https://docs.y.uno/zh-hans/docs/payment-features/promotion-codes)介绍了完整流程。

在响应和每个 `payment.*` webhook 中，Yuno 会填充 `YUNO_PROMOTION` 行（`quote_id`、`id` = 促销 ID、以支付币种表示的 `unit_amount`，以及在 Yuno 掌握时提供的 `name`），并添加 `discount_amount`，即这些行的金额总和。您的 `MERCHANT` 行会保留其 `id`、`name` 和 `unit_amount`；当支付携带 Yuno 促销时，创建支付的响应、检索支付和 webhooks 会先列出 Yuno 行，并用 `type: MERCHANT` 标记您的行。`amount` 永远不会被改写；实际收取的净额位于交易中（`transactions.amount`）。使用 `code` 发送的支付也会以相同方式响应：Yuno 会在创建支付之前将促销码换成报价，因此创建支付的响应中包含已填充的 `YUNO_PROMOTION` 行，其中带有该报价的 `quote_id`，而永远不会包含 `code`。

在以下示例中，您可以看到一个请求，说明 5 USD 的折扣金额是 50 USD 最终交易金额的一部分。商户计算的折扣仅供参考：该金额已包含在 `amount` 中，不会再次添加。

```json Example theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
     --url https://api-sandbox.y.uno/v1/payments \
     --header 'X-Idempotency-Key: <Your idempotency-key>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>' \
     --data '
{
    "description": "Test",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "US",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "USD",
        "value": 50.00
    },
    "customer_payer": {
        "id":"967ecd18-d898-4b88-9400-dd5b01b18edc"
    },
    "additional_data": {
          "order": {
              "discounts": [
                {
                  "id": "10OFF",
                  "name":"Offer",
                  "unit_amount":5.00
                }
              ]
          }
      },
    "workflow": "DIRECT",
    "payment_method": {
        "type":"CARD",
        "vaulted_token": "eb8caa17-6407-457b-960e-125d8d7a90c1",
        "detail": {
           "card": {
               "stored_credentials":{
                  "reason":"CARD_ON_FILE",
                  "usage": "USED"
              }
           }
        }
    }
}
'
```

## 客户验证

专用对象（`customer_payer.merchant_customer_validations`）可让您为欺诈预防查询指定特定的客户验证规则。

| 字段 | 类型 | 描述 |
| :- | :- | :- |
| account\_is\_verified | bool | 客户的账户此前是否已在商户侧完成验证。默认为 True |
| email\_is\_verified | bool | 客户的 email 此前是否已在商户侧完成验证。默认为 True |
| phone\_is\_verified | bool | 客户的电话此前是否已在商户侧完成验证。默认为 True |

在以下示例中，您可以看到一个请求，说明客户此前已在 Yuno 之外完成验证。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
[...]
  "description": "Test PIX",
    "account_id":"{{account-code}}",
    "merchant_order_id": "0000022",
    "country": "BR",
    "amount": {
        "currency": "BRL",
        "value": 50
    },
   "customer_payer": {
        "merchant_customer_id": "AA001",
        "first_name": "VALERIO",
        "last_name": "DE AGUIAR ZORZATO",
        "email": "test_user_1431202421@testuser.com",
        "phone": {
                "number": "11992149494",
                "country_code": "55"
        },
        "document": {
                "document_type": "CPF",
                "document_number": "96050176876"
        },
        "merchant_customer_validations":{
          "phone_is_verified":true,
          "account_is_verified":true,
          "email_is_verified":true
        }
    },
[...]
```


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