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

# 卖家（特许经营）

> 管理特许经营商户身份和服务提供商专属凭证。

Sellers API 允许特许经营商户按服务提供商注册卖家身份，以便在支付时自动解析正确的 `merchant_id`。

经营多家特许经营门店的商户可以为每家门店分配不同的服务提供商凭证（例如 Cielo 使用 `CIELO_456`，Adyen 使用 `ADYEN_789`），系统会根据处理该支付的服务提供商选择正确的凭证。

## 关键概念

* **组织级范围**：卖家在特定的 `account_code` 下创建，但在整个组织范围内可用：同一组织内的任何账户都可以在支付请求中引用该卖家。
* **非阻塞解析**：特许经营解析绝不会阻塞支付。如果不存在映射或服务不可用，支付将使用连接中默认的 `merchant_id` 继续进行。
* **多态详情**：`payment_method` 数组使用多态的 `detail` 结构。detail 对象的结构取决于 `payment_method_type` 字段（`CARD` → `detail.card.provider`，`APPLE_PAY` → `detail.wallet.provider`）。
* **软删除**：删除卖家会软删除该记录及所有关联的支付方式数据。过去的支付不受影响。

## 身份验证

所有 Sellers API endpoint 都需要以下标头：

| 标头 | 必填 | 描述 |
| :- | :- | :- |
| `public-api-key` | 是 | 您的 Yuno 公共 API 密钥。 |
| `private-secret-key` | 是 | 您的 Yuno 私有密钥。 |
| `X-Account-Code` | 是 | 账户的 UUID 标识符。 |
| `X-Idempotency-Key` | 建议（POST） | 用于安全重试的唯一 UUID。 |

## 业务规则

1. **唯一性**：每个 `(account_code, merchant_seller_id)` 对应一个卖家。在一个卖家中，每个 `(provider.id, payment_method_type)` 必须唯一。
2. **多家门店**：一个商户可以注册多个 `merchant_seller_id` 值（每家特许经营门店一个）。
3. **多个服务提供商**：每个卖家可以拥有针对多个服务提供商和支付方式类型的 `payment_method` 条目。
4. **卖家引用**：支付通过 `seller_id`（Yuno UUID）或 `merchant_seller_id`（商户的标识符）引用卖家，两者互斥。
5. **字段覆盖**：在支付请求中发送的卖家字段仅针对该支付覆盖已存储的值，不会回写保存。
6. **解析优先级**：卖家映射优先于连接的 `merchant_id`。如果不存在映射，则使用原始的 `merchant_id`。
7. **组织级范围**：卖家映射在组织层级可用：组织中的任何账户都可以使用在该组织下注册的任何卖家。
8. **“Operates as Franchise”标志**：在连接上启用后，集成逻辑会使用特许经营映射中的 `merchant_id`，而不是连接的 `merchant_id`。
9. **软删除**：删除卖家会软删除该记录及所有支付方式数据。过去的支付不受影响。之后的支付将回退为使用连接默认的 `merchant_id`。
10. **向后兼容**：当两个卖家引用字段都不存在时，将完全跳过此功能。

> [card] [卖家对象](https://docs.y.uno/zh-hans/reference/sellers/the-seller-object.md)
>
> 了解卖家身份的结构和属性。

> [card] [在支付中使用卖家](https://docs.y.uno/zh-hans/reference/sellers/using-sellers-in-payments.md)
>
> 了解如何在支付请求中引用卖家。


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