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

# Seamless Lite 模式

> 将 Web Seamless Lite 集成（yuno.startSeamlessCheckout + yuno.mountSeamlessCheckoutLite）迁移到统一 Transaction API。

Seamless Lite 结合了两个旧版特性：**Seamless**（SDK 在内部创建支付，不对外暴露 `yunoCreatePayment` callback）和 **Lite**（支付方式由商户预先选择；SDK 仅为该支付方式渲染表单）。

在统一 API 中，`transaction.start({ paymentMethod })` 为预先选择的支付方式挂载表单，`transaction.submit()` 从您的按钮发起支付。配置中没有 `createPayment`（Seamless 始终是托管模式）。

## 开始之前

* 加载统一 SDK 包而不是旧版包，并按照代码对照所示进行初始化：`window.Yuno.initialize(...)` 变为 `SdkPayments.initialize(...)`。您的公共 API 密钥以及您的 backend 创建的结账会话保持不变（[开始之前](https://docs.y.uno/zh-hans/docs/yuno-sdk/get-started.md#before-you-begin)）。
* 决定由谁创建支付。结账会话的 `workflow` 必须与该决定一致：

| 由谁创建支付 | 在 Seamless Lite 中您使用的是 | 在统一 API 中 | 会话 `workflow` |
| - | - | - | - |
| 您的 backend | 无对应项：Seamless 从不允许您创建支付 | 覆盖 `createPayment` | 默认（`SDK_CHECKOUT`） |
| SDK | 始终如此 | 不覆盖 | `SDK_SEAMLESS` |

> [!WARNING]
>
> 使用默认 workflow 的会话如果没有覆盖 `createPayment`，最终会以 `INTERNAL_ERROR` 结束：backend 会拒绝 SDK 创建支付。请参阅 [`createPayment`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/create-payment)。

## 代码对照

```typescript Before. Seamless Lite theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const yuno = await window.Yuno.initialize('your-public-api-key')

await yuno.startSeamlessCheckout({
    checkoutSession: 'session-from-backend',
    elementSelector: '#root',
    countryCode: 'CO',
    language: 'en',
    yunoPaymentResult: (status) => console.log('done:', status),
})

await yuno.mountSeamlessCheckoutLite({
    paymentMethodType: 'PIX',
    vaultedToken: null,
})

// Merchant's pay button triggers. SDK does everything else
document.getElementById('pay').addEventListener('click', () => {
    yuno.startPayment()
})
```

```typescript After. Unified Transaction (managed + pre-selected) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const sdkPayments = await SdkPayments.initialize('your-public-api-key')

const transaction = sdkPayments.transaction({
    checkoutSession: 'session-from-backend',
    countryCode: 'CO',
    language: 'en',
    elementSelector: '#root',
    showPayButton: false,
    // managed mode: no createPayment wired
    onStatus: (result) => console.log('done:', result.status),
})

// Mount the form for the pre-selected method
await transaction.start({
    paymentMethod: { type: 'PIX' },
})

// Merchant's pay button submits it. SDK does everything else
document.getElementById('pay').addEventListener('click', () => {
    transaction.submit()
})
```

## 变更内容

按您编辑代码的顺序分组。**重命名**：作用相同，名称变化。**移动**：值相同，归属对象变化。**移除**：无需调用任何内容。**新增**：没有旧版对应项。最后一列是重命名之外您唯一需要做的事。

### 初始化和配置

| Seamless Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `window.Yuno.initialize(publicApiKey)` | `SdkPayments.initialize(publicApiKey)` | 重命名 | 全局对象是 `window.SdkPayments`。与之前一样，对它使用 `await`：它会解析为您用来创建交易的 `SdkPayments` 实例。 |
| `startSeamlessCheckout` 配置中的 `checkoutSession`、`countryCode`、`language` | 交易配置中的相同字段 | 移动 | 值相同，只有一个工厂方法。 |
| `startSeamlessCheckout` 配置中的 `elementSelector` | 交易配置中的 `elementSelector` | 移动 | 必填。`start({ paymentMethod })` 会在该元素内渲染表单，缺少它时会抛出错误。Headless 流程会忽略它。 |
| `startSeamlessCheckout` 配置中的 `showPayButton` | 交易配置中的 `showPayButton` | 移动 | 含义相同。仅适用于支付流程。 |

### Callback

| Seamless Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `yunoPaymentResult(status, subStatus?)` | `onStatus(result)` | 重命名 | 仍是唯一的结果 callback，现在是交易配置中的一个字段。它接收一个 `TransactionStatus` 对象（`status`、`substatus`、`message`）。请参阅 [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。 |
| `yunoError(message, data?)` | *（已移除）* | 移除 | 错误通过 `onStatus` 或被拒绝的 `start()` Promise 传递。 |
| `onLoading({ isLoading, type })` | `showLoading(isLoading)` | 重命名 | 可选。仅为 Boolean 信号。请参阅 [`showLoading`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-loading)。 |
| *（无：支付创建始终是托管的）* | `createPayment` | 新增 | 不要接入它。不提供它会让 SDK 保持托管模式，即 Seamless 采用的同一模型。 |

### 入口点

| Seamless Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `yuno.startSeamlessCheckout(config)` | `sdkPayments.transaction(config)` | 重命名 | `Seamless` 工厂方法已不存在：请使用常规工厂方法，且不提供 `createPayment`（请参阅“Callback”）。 |
| `yuno.mountSeamlessCheckoutLite({ paymentMethodType, vaultedToken })` + `yuno.startPayment()`（商户触发） | `transaction.start({ paymentMethod: { type, vaultedToken } })` + `transaction.submit()` | 重命名 | 同样是两个步骤。`start()` 在交易配置中设置的 `elementSelector` 内挂载表单，预先选择的支付方式成为它的 `paymentMethod` 参数。`submit()` 是您的支付触发器。设置 `showPayButton: false` 可隐藏 SDK 的按钮。`Lite` 与 `Full` 不再作为方法区分：现在的区别在于您是直接将 `paymentMethod` 传给 `start()`（预先选择），还是在 `getPaymentMethodsViews` 中从 `onPaymentSelected` 获取它（用户从列表中选择）。 |
| `yuno.submitOneTimeTokenForm()` | `transaction.submit()` | 重命名 | 从您自己的按钮提交 `start()` 挂载的表单。请与 `showPayButton: false` 一起使用。请参阅 [Web：从您自己的按钮提交](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-view.md#web-submit-from-your-own-button)。 |

## 相关内容

* [`TransactionConfig`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-pass#transaction-config)。完整的字段参考。
* [Seamless 模式](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/web/seamless.md)。适用于 Seamless Full 和 Seamless External Buttons。
* [Lite 模式](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/web/lite.md)。适用于非 Seamless 的 Lite（它支持用于手动模式的 `yunoCreatePayment`）。


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