> ## 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 Web SDK，不暴露 Yuno 品牌标识。

> [!NOTE]
>
> **This page documents a legacy SDK.** Starting a new integration? Use the [Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md). Already on a legacy SDK? Follow the [migration guide](https://docs.y.uno/docs/yuno-sdk/migration/overview.md).
>
> The new **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) replaces the Full, Lite, Seamless, Render, Headless, and Secure Fields SDKs with one API across every platform. Legacy SDKs remain supported side by side during the transition and are scheduled for deprecation in **2027**. Contact your Account Manager for migration planning.

白标支持让合作伙伴可以从自己的源提供 Yuno Web SDK，而不会让字符串 `Yuno` 泄露到商户页面中：无论是 DOM、全局变量、派发的事件，还是出站网络流量中都不会出现。

> [!TIP]
>
> 已在 Web SDK 1.9.1 中发布。旧版 `window.Yuno` 全局对象和 `yuno-sdk-ready` 事件作为向后兼容的别名保留，因此现有集成无需任何更改即可继续运行。

## SDK 暴露的内容

| 关注项 | 主要名称（白标） | 旧版别名（仍可使用） |
| :- | :- | :- |
| 全局对象 | `window.SdkPayments` | `window.Yuno` |
| 就绪事件 | `'sdk-payments-ready'` | `'yuno-sdk-ready'` |
| CSS 类名前缀 | `sdk-payments-*` | — |
| DOM `id`、`data-testid`、字体链接 id | `sdk-payments-*` | — |
| 字体系列 | `Sdk-Payments-Inter` | `Yuno-Inter`（作为后备保留） |

新旧全局对象都引用同一个对象，两个事件都会在 bundle 加载时派发，因此您可以在迁移期间混合使用它们，而不会破坏任何一种形式。

## 运行时 URL 覆盖

在自己的源上托管 SDK 的合作伙伴，会在 `initialize()` 时将 SDK 指向自定义 endpoint，而不是依赖编译时的默认值。

```javascript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
SdkPayments.initialize(publicApiKey, applicationSession, {
  // Overrides the API base URL the SDK calls (REST + WebSocket).
  // Also forwarded into the card-form and secure-fields iframes so
  // their internal calls land on the partner origin too.
  apiUrl: 'https://payments.example.com',

  // Overrides the host that serves SDK static assets — 3DS pages,
  // card-form bundle, fonts, and (in recent SDK builds) the icons,
  // brand logos, and country flags that the SDK otherwise loads straight
  // from icons.prod.y.uno / sdk.prod.y.uno.
  assetUrl: 'https://payments.example.com',
})
```

每个覆盖项在端到端流程中影响的内容：

| 选项 | 影响范围 |
| :- | :- |
| `apiUrl` | SDK REST 调用、WebSocket 升级、监控/Datadog 转发器、Secure Fields 中介器、银行卡表单 iframe API 基础地址。 |
| `assetUrl` | 3DS 挑战/重定向/session-id 页面、银行卡表单微应用 URL、字体 CSS、用于代码分割 chunk 的运行时 `__webpack_public_path__`，以及位于 `icons.prod.y.uno` / `sdk.prod.y.uno` 上的硬编码图标/品牌徽标/国旗资源（替换主机，保留路径；适用于较新的 SDK 构建版本）。 |

> [!NOTE]
>
> 对于典型的白标部署，请为两个选项传入相同的值。SDK 会原样使用该值：当 `assetUrl` 已以 `/v<x.y>` 段结尾时，不再追加该段，也不会为覆盖值添加区域前缀。
>
> 静态 CDN 主机替换（图标、品牌徽标、国旗）会路由到 `assetUrl`（如已设置），否则回退到 `apiUrl`，因此为两者传入相同的值会让所有请求都经过同一个源。只有 `*.y.uno` 资源 URL 会被重写；商户在外部 CDN 上提供的图标保持不变。

## 中性的商户 callback

callback 名称新增了白标中性的别名。旧版 `yuno*` 名称仍可接受并会在内部转发，但已弃用，将在未来的主要版本中移除。

| 旧版 callback | 新的中性名称 |
| :- | :- |
| `yunoCreatePayment` | `createPayment` |
| `yunoPaymentMethodSelected` | `paymentMethodSelected` |
| `yunoPaymentResult` | `paymentResult` |
| `yunoError` | `error` |

## 集成示例

```html theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
<!-- Loaded from the partner origin, not sdk-web.y.uno -->
<script src="https://payments.example.com/v1.9/main.js"></script>
<script>
  async function startYuno() {
    const sdk = SdkPayments.initialize(PUBLIC_API_KEY, APPLICATION_SESSION, {
      apiUrl: 'https://payments.example.com',
      assetUrl: 'https://payments.example.com',
    })

    await sdk.startCheckout({
      checkoutSession: CHECKOUT_SESSION,
      createPayment:  (ott, info) => { /* ... */ },
      paymentResult:  (status)    => { /* ... */ },
      error:          (msg, data) => { /* ... */ },
    })

    sdk.mountCheckout()
  }

  if (window.SdkPayments) startYuno()
  else window.addEventListener('sdk-payments-ready', startYuno)
</script>
```

## 验证白标设置

从非 Yuno 源加载 SDK 后，商户页面中不应出现以下任何内容：

* 带有 `class="yuno-*"` 或 `id="yuno-*"` 的元素。
* 解析后的字体系列为 `Yuno-Inter`。
* 发往 `*.y.uno` 主机的网络请求，包括用于图标、品牌徽标和国旗的静态 CDN `icons.prod.y.uno` 和 `sdk.prod.y.uno`。只有较新的 SDK 构建版本才会将这些主机替换为您的源；较旧的构建版本仍会直接从 CDN 获取它们。
* 从 SDK 1.10.9 开始，您的源上出现 `/sdk-static-bundles-ms/…`（字体样式表）的 `404`。您的代理必须将 `/sdk-static-bundles-ms/*` 转发到 `prod.y.uno`。请参阅[合作伙伴代理必须转发的路由](https://docs.y.uno/zh-hans/docs/sdks/customization/web/white-label-proxy-server.md#routes-a-partner-proxy-must-forward)。

并且应存在以下内容：

* `window.SdkPayments` 解析为 SDK 实例工厂。
* `'sdk-payments-ready'` 在 bundle 加载时触发一次。
* DOM 节点使用 `class="sdk-payments-*"` / `id="sdk-payments-*"`。

## 本地测试工具

[`yuno-payments/yuno-sdk-web`](https://github.com/yuno-payments/yuno-sdk-web/tree/main/white-label-proxy-server) 代码仓库的 `white-label-proxy-server/` 目录下有一个临时代理服务器。它监听 `http://localhost:9090`，从非 Yuno 源提供一个落地页，并以透明方式将 SDK 资源/API/WebSocket 流量代理到上游。将合作伙伴测试页面的 `<script src>` 指向 `http://localhost:9090/v1.7/main.js`，即可端到端地测试白标代码路径。

> [!NOTE]
>
> 上面的 `v1.7` 版本和[集成示例](#integration-example)中的 `v1.9` 版本都是有意为之，并非笔误：`v1.9` 是真实的生产环境 SDK 版本，而 `v1.7` 只是本地测试工具自身硬编码的后备版本（请参阅[版本规范化](https://docs.y.uno/zh-hans/docs/sdks/customization/web/white-label-proxy-server.md#version-normalization)）。

```shell theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
cd yuno-sdk-web/white-label-proxy-server
cp .env.example .env   # tweak SDK_UPSTREAM / BACKEND_URL if needed
npm install
npm start              # http://localhost:9090
```

同一个测试工具还可作为**托管的 Payment Link checkout**（通常为 `checkout.<env>.y.uno`）的前端，因此该页面也可以白标化到商户的源或子路径上。关于面向商户的流程（重写重定向 URL 并追加 `apiUrl` / `assetUrl`），请参阅 [Payment Link White Label](https://docs.y.uno/zh-hans/docs/sdks/customization/web/payment-link-white-label.md)。

如需了解完整架构、[托管 checkout 白标](https://docs.y.uno/zh-hans/docs/sdks/customization/web/white-label-proxy-server.md#hosted-checkout-white-label-payment-link)流程、`SDK_MAIN_JS` 版本固定行为、环境变量矩阵（prod / staging / dev 上游）以及路由表，请参阅 [White Label Proxy Server](https://docs.y.uno/zh-hans/docs/sdks/customization/web/white-label-proxy-server.md)。


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