> ## 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 集成错误的响应、原因和修复方法：密钥、工作流、路由、测试卡、webhooks、重试和金额。

入门

参考

在第一列中找到您收到的响应，然后应用对应的修复方法。再次发送支付请求之前，请先确认第一个请求是否已创建支付。

## 查找您收到的响应

| 响应 | 原因 | 修复方法 |
| - | - | - |
| `401` `INVALID_CREDENTIALS` | `public-api-key` 或 `private-secret-key` 标头缺失或错误。sandbox 和生产环境使用不同的密钥。 | 发送您所调用环境的密钥。在 sandbox 中，请在 Test Mode 下从 Dashboard 复制密钥。请参阅[身份验证](https://docs.y.uno/reference/getting-started/authentication.md)和[开发者凭证](https://docs.y.uno/zh-hans/docs/using-yuno/settings/developers-credentials.md)。 |
| 交易最终状态为 `INTERNAL_ERROR` | `workflow` 与您的集成方式不匹配。 | 由您的服务器发送卡信息时，使用 `DIRECT`。由 Web SDK 创建支付时，在结账会话上使用 `SDK_SEAMLESS`。 |
| 响应中没有服务提供商 | Card 没有已发布的路由。 | 打开 [Routing](https://docs.y.uno/zh-hans/docs/using-yuno/dashboard-overview/routing.md)，检查 Card 路由是否位于 **Published** 选项卡下。检查 Checkout builder 中是否已开启 Card。 |
| 卡支付显示已拒绝 | 测试卡仅适用于特定的服务提供商。只有当您的 sandbox 将 Card 路由到 Yuno Test Payment Gateway 时，快速入门中的测试卡才有效。 | 将 Card 路由到该 gateway，或使用您所路由到的服务提供商的测试卡。请参阅 [Yuno Test Payment Gateway](https://docs.y.uno/zh-hans/docs/direct-integration-use-cases/yuno-testing-gateway.md)。 |
| checkout 中没有支付方式 | Checkout builder 仅显示已有已发布路由且已开启的支付方式。显示条件（国家或地区、金额、币种或元数据）也可能隐藏某种支付方式。 | 发布路由、开启该支付方式，然后在 Checkout builder 中点击 **Publish settings**。接着检查该支付方式的显示条件。 |
| `400` `INVALID_CUSTOMER_FOR_TOKEN` | 支付中的令牌关联的是另一个客户对象。 | 发送该令牌所属的客户。如果您在创建结账会话时使用了 `customer_id`，请在 `customer_payer.id` 中发送同一客户。请参阅[支付流程](https://docs.y.uno/zh-hans/docs/how-yuno-works/how-yuno-payment-flow-works.md)。 |
| `checkout.sdk_action_required` 为 `true`，且 checkout 无法完成 | 该支付需要客户执行额外操作（例如 3DS 或重定向），而 SDK 尚未执行该操作。 | 创建支付后，调用 SDK 的 `continuePayment` 方法。 |
| 重定向后支付一直处于 `PENDING` 状态 | 该支付方式是异步的，因此支付在达到最终状态之前会经过 `PENDING`。 | 履行订单之前，请在您的服务器上通过 [webhook](https://docs.y.uno/zh-hans/docs/webhooks/index.md) 或[检索支付](https://docs.y.uno/reference/payments/retrieve-payment-by-id-v2.md)确认最终状态。 |
| `METADATA` 路由条件始终不匹配 | `payment.metadata` 中缺少该键。无论使用哪个运算符（包括 `NOT_EQUAL` 和 `NOT_ONE_OF`），缺失的键都不会匹配。 | 在支付的 `metadata` 中发送该键。要根据某个键是否存在来拆分流量，请参阅[路由条件](https://docs.y.uno/reference/organizations/routing/routing-conditions.md)。 |
| `x-hmac-signature` 不匹配 | 您的代码在计算签名之前解析或重新序列化了请求体，或者使用了另一个密钥。 | 使用为该 webhook 配置的密钥，基于原始请求体计算 HMAC。请参阅[验证 webhook 签名](https://docs.y.uno/zh-hans/docs/webhooks/verify-webhook-signatures-hmac.md)。 |
| 您的 endpoint 将同一个 webhook 处理了两次 | 如果投递没有收到 HTTP 200，Yuno 会重试，因此同一事件可能会多次到达。 | 将 `account_id`、`type_event` 和幂等性键组合起来记录每个已处理的事件，并跳过已记录的事件。只用幂等性键会丢掉真实事件，因为退款和拒付事件携带的 `data.payment.idempotency_key` 与其所属支付相同。请参阅[去重](https://docs.y.uno/zh-hans/docs/webhooks/index.md#de-duplication)。 |
| 金额是订单总额的 100 倍 | 金额是以辅币单位（分）发送的。`amount.value` 以主币单位计。 | 对于 USD 25.00，请发送 `25`。根据您存储的订单校验金额。 |
| `400` `INVALID_PARAMETERS`，消息为 `The field 'amount.value' has an invalid amount.` | 该币种没有辅币单位（例如 `KRW`、`JPY` 或 `CLP`），而 `value` 带有小数部分。Yuno 不会对该值进行四舍五入。退款、`cardholder_amount` 和拆分金额也会执行相同的检查。 | 发送整数。在构建订单时取整一次，并在会话、支付和每笔退款中使用相同的值。请参阅[金额与币种](https://docs.y.uno/zh-hans/docs/basic-concepts/amounts-and-currencies.md)。 |

## 处理结果不确定的请求

如果请求超时、连接中断、返回 `500` 或返回您无法解析的响应，请使用相同的 `X-Idempotency-Key` 重试。如果第一个请求已成功，使用新键重试会创建重复的操作。

重试会返回以下结果之一：

* \*\*原始支付。\*\*第一个请求已创建支付，因此请处理该支付的当前状态。Yuno 会忽略重试请求的请求体。
* \*\*`400 REQUEST_IN_PROCESS`。\*\*第一个请求仍在处理中。请在几秒后使用相同的键重试。
* \*\*`400 IDEMPOTENCY_DUPLICATED`。\*\*第一个请求在创建支付之前失败。此键下不存在任何支付，且该键无法再次使用。请修正请求，然后使用新键发送。
* \*\*正常处理。\*\*第一个请求在处理开始之前即被拒绝，因此该键未被使用，重试将作为新请求处理。

完整规则请参阅[幂等性](https://docs.y.uno/reference/getting-started/authentication.md#idempotency)。有关所有 HTTP 状态和错误码，请参阅[响应码](https://docs.y.uno/reference/getting-started/response-codes.md)。

## 检查环境是否正确

sandbox 和生产环境使用不同的密钥。比对记录之前，请检查以下 3 个值：

* \*\*API 主机。\*\*sandbox 和生产环境使用不同的基础 URL。请参阅 [Developers](https://docs.y.uno/zh-hans/docs/developers.md)。
* \*\*Dashboard 模式。\*\*顶部栏中的上下文标签显示 **Test** 或 **Live**。
* \*\*密钥。\*\*每个账户针对每种模式都有一组单独的密钥。

请参阅[环境](https://docs.y.uno/zh-hans/docs/using-yuno/environments.md)和[开发者凭证](https://docs.y.uno/zh-hans/docs/using-yuno/settings/developers-credentials.md)。

## 寻求帮助时提供有用的信息

请发送邮件至 [support@y.uno](mailto:support@y.uno)，并附上以下信息：

* 环境，以及请求的时间和所在时区。
* endpoint、HTTP 方法、HTTP 状态和错误 `code`。
* 支付 ID 或结账会话 ID，以及您的订单参考号。
* SDK 平台和版本、您预期的结果以及实际发生的情况。
* 复现步骤，以及相关的请求和响应字段。

删除私钥、凭证、原始卡号以及您无需发送的个人数据。查看[服务状态](https://status.y.uno)了解当前事件，并参阅 [Developers](https://docs.y.uno/zh-hans/docs/developers.md) 获取 SDK 版本和更新日志。

## 后续步骤

<ol>
  <li>[上线](https://docs.y.uno/zh-hans/docs/go-live.md)指南 Live 密钥、已发布的路由、经过验证的 webhooks 以及第一笔真实支付。</li>
  <li>[响应码](https://docs.y.uno/reference/getting-started/response-codes.md)参考 Yuno API 返回的 HTTP 状态和错误码。</li>
  <li>[Webhooks](https://docs.y.uno/zh-hans/docs/webhooks/index.md)指南 投递、重试、去重和签名校验。</li>
  <li>[快速入门](https://docs.y.uno/zh-hans/docs/quickstart.md)教程 连接测试 gateway 并发送一笔 sandbox 支付。</li>
</ol>


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