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

# 托管 Checkout 错误

> 托管支付链接的税费报价和支付错误，以及需要显示的字段和消息

带有 `tax_collection` 或 `local_pricing` 的支付链接在托管 checkout 上完成支付。页面根据买家的地址和税号获取税费报价，然后使用存储在结账会话上的报价进行支付。本页列出这两个步骤的错误，以及页面如何显示每个错误。

## 错误结构

每个错误都包含 4 个键：

| 键 | 类型 | 描述 |
| - | - | - |
| `code` | string | 每种情况对应一个代码。代码的含义永远不会改变。 |
| `field` | string 或 `null` | 买家需要修正的字段，使用其在 `ui.required_fields` 分组中的名称：`country`、`zip_code`、`business_name`、`tax_id_type` 或 `tax_id`。错误不涉及单个字段时为 `null`。 |
| `message_id` | string 或 `null` | 页面显示的该字段 `error_messages` 条目的 id：`invalid`、`unsupported` 或 `country_mismatch`。`field` 为 `null` 时为 `null`。 |
| `messages` | 字符串数组 | 用于日志的技术细节。不会向买家显示。 |

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "TAX_LOCATION_INVALID",
  "field": "zip_code",
  "message_id": "invalid",
  "messages": ["postal_code 1414142412 is not a valid US postal code."]
}
```

`field` 和 `message_id` 指明买家需要修正哪个字段，以及适用该字段的哪个 `error_messages` 条目，以便在字段旁边以买家的语言显示错误。没有 `field` 的错误以通知形式显示。

## 税费报价：字段错误

均返回 `422`。

| `code` | `field` | `message_id` | 触发时机 |
| - | - | - | - |
| `TAX_COUNTRY_UNSUPPORTED` | `country` | `unsupported` | 账单国家/地区不是两位字母的 ISO 代码，或无法为该国家/地区计算税费。 |
| `TAX_LOCATION_INVALID` | `zip_code` | `invalid` | 该国家/地区需要邮政编码（US 和 CA），但邮政编码缺失或不符合该国家/地区的格式：US 为 `12345` 或 `12345-6789`，CA 为 `A1A 1A1`。 |
| `BUSINESS_NAME_INVALID` | `business_name` | `invalid` | 买家以企业身份购买，但企业名称为空或超过 255 个字符。 |
| `TAX_ID_INVALID` | `tax_id` | `invalid` | 有税号类型但没有税号（或相反）、税号过长，或税务服务提供商驳回了该税号。 |
| `TAX_ID_TYPE_INVALID` | `tax_id_type` | `invalid` | 税号类型不是已知类型。 |
| `TAX_ID_COUNTRY_MISMATCH` | `tax_id_type` | `country_mismatch` | 税号类型不属于账单国家/地区，例如德国地址使用 `us_ein`。 |

## 税费报价：其他错误

`field` 和 `message_id` 为 `null`。

| HTTP | `code` | 触发时机 |
| - | - | - |
| 400 | `TAX_QUOTE_INVALID_REQUEST` | 税务服务提供商因上述字段以外的原因驳回了请求。 |
| 400 | `TAX_COLLECTION_NOT_ENABLED` | 该支付链接不收取税费。 |
| 400 | `TAX_QUOTE_NOT_APPLICABLE` | 结账会话中没有需要报价的内容。 |
| 400 | `INVALID_CHECKOUT_SESSION` | 结账会话已被使用或已过期。 |
| 400 | `INVALID_ACCOUNT_CODE` | 结账会话属于另一个账户。 |
| 400 | `MERCHANT_NOT_FOUND` | 该账户未配置税务服务提供商。 |
| 429 | `TOO_MANY_REQUESTS` | 同一结账会话在 1 分钟内报价超过 20 次。 |
| 502 | `TAX_QUOTE_UNAVAILABLE` | 税务服务提供商出错或未及时响应。请重试。 |
| 502 | `SESSION_UPDATE_FAILED` | 无法将报价存储到结账会话上。请重试。 |

## 支付错误

`field` 和 `message_id` 为 `null`。不会创建支付。报价过期时，页面会重新报价，并请买家确认新的总额。

| HTTP | `code` | 触发时机 |
| - | - | - |
| 422 | `TAX_QUOTE_EXPIRED` | 结账会话的税费报价已过期（税费报价的有效期为 30 分钟）。 |
| 422 | `FX_QUOTE_EXPIRED` | 买家以本地币种支付时，结账会话的本地币种报价已过期。 |
| 422 | `TAX_QUOTE_INVALID` | 结账会话没有税费报价。 |
| 422 | `FX_QUOTE_INVALID` | 结账会话没有完整的本地币种报价。 |
| 400 | `TAX_QUOTE_INVALID` | 税费报价与支付链接不匹配：链接的 `amount.value` 不是其 `external_subscription` 价格的小计。请使用正确的金额创建新链接。 |
| 4xx | `FX_QUOTE_INVALID` | 支付驳回了结账会话的本地币种报价。 |

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "TAX_QUOTE_EXPIRED",
  "field": null,
  "message_id": null,
  "messages": ["The tax quote of the checkout session expired at 2026-11-06T22:02:02Z. Request a new tax quote."]
}
```

## 另请参阅

* [支付链接对象](https://docs.y.uno/zh-hans/reference/payment-links/the-payment-link-object.md)
* [创建支付链接](https://docs.y.uno/zh-hans/reference/payment-links/create-payment-link.md)


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