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

# 在支付中使用卖家

> 关于如何通过 additional_data.seller_details 在支付请求中引用已注册卖家的指南。

注册卖家映射后，您可以通过 `additional_data.seller_details` 在支付请求中引用该卖家。系统会在支付时根据处理该支付的服务提供商自动解析正确的 `merchant_id`。

## 引用卖家

您可以使用以下任一标识符引用卖家（两者**互斥**，只能发送其中一个）：

| 字段 | 描述 |
| :- | :- |
| `merchant_seller_id` | 商户自己的标识符（例如 `"FRANCHISE_STORE_001"`）。 |
| `seller_id` | Yuno 生成的 UUID（例如 `"f7a1b2c3-d4e5-6789-abcd-ef0123456789"`）。 |

### 示例：使用 `merchant_seller_id` 的支付

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "amount": { "currency": "BRL", "value": 10000 },
  "country": "BR",
  "payment_method": {
    "type": "CARD",
    "token": "pm_tok_abc123"
  },
  "additional_data": {
    "seller_details": {
      "merchant_seller_id": "FRANCHISE_STORE_001"
    }
  }
}
```

### 示例：带字段覆盖的支付

当您在卖家引用之外还发送其他卖家字段时，这些字段仅针对该支付**覆盖**已存储的卖家值。它们不会回写保存到卖家映射中。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "amount": { "currency": "BRL", "value": 10000 },
  "country": "BR",
  "payment_method": {
    "type": "CARD",
    "token": "pm_tok_abc123"
  },
  "additional_data": {
    "seller_details": {
      "merchant_seller_id": "FRANCHISE_STORE_001",
      "name": "Store 001 - Campinas",
      "document": {
        "type": "CNPJ",
        "number": "98765432000111"
      }
    }
  }
}
```

## 解析的工作原理

1. 商户发送支付请求，并在 `additional_data.seller_details` 中包含 `merchant_seller_id` 或 `seller_id`。
2. 支付经过标准流水线处理。路由会选择一个服务提供商（例如 Cielo）。
3. 路由完成后，系统按 `(organization, seller_identifier, provider, payment_method_type)` 查找特许经营映射。
4. **如果找到**：连接的 `merchant_id` 会被解析出的 `merchant_id` 覆盖。请求中发送的任何卖家字段都会针对该支付覆盖已存储的值。
5. **如果未找到或服务不可用**：支付将使用连接默认的 `merchant_id` 继续进行（平稳回退）。

### 向后兼容

当 `seller_id` 和 `merchant_seller_id` 都不存在时，将完全跳过整个特许经营功能，对现有流程没有任何影响。


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