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

# Full 模式

> 将 Web Full 集成（带有嵌入式支付方式列表的 yuno.startCheckout）迁移到统一的 Transaction API。

Full 模式过去在您的布局中渲染 SDK 的支付方式抽屉。用户选择一种支付方式，SDK 渲染相应的表单、进行令牌化、处理支付并报告结果。在统一 API 中，同样的流程使用单个 `Transaction` 加上 `transaction.getPaymentMethodsViews({ types: ['paymentMethodList'], onPaymentSelected })`。返回的 `views.paymentMethodList` 提供一个 `.mount({ elementSelector })` 方法。

## 开始之前

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

| 由谁创建支付 | 在 Full 中您的做法 | 在统一 API 中 | 会话 `workflow` |
| - | - | - | - |
| 您的 backend | 已实现 `yunoCreatePayment` | 覆盖 `createPayment` | 默认（`SDK_CHECKOUT`） |
| SDK | 没有 `yunoCreatePayment` | 不覆盖 | `SDK_SEAMLESS` |

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

## 对照

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

await yuno.startCheckout({
    checkoutSession: 'session-from-backend',
    elementSelector: '#root',
    countryCode: 'CO',
    language: 'en',
    renderMode: { type: 'modal' },
    paymentListConfig: {
        scrollContainerSelector: '#scroll-container',
        bottomOffsetPx: 0,
    },
    yunoPaymentMethodSelected: ({ type, name }) => {
        console.log('selected:', type, name)
    },
    yunoPaymentResult: (status, subStatus) => {
        console.log('Final status:', status, subStatus)
    },
    yunoError: (error) => {
        console.log('Error', error)
    },
})

await yuno.mountCheckout()
```

```typescript After. Unified Transaction 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: '#payment-form', // form container for the selected method
    paymentListConfig: {
        scrollContainerSelector: '#scroll-container',
        bottomOffsetPx: 0,
    },
    onStatus: (result) => {
        console.log('Final status:', result.status, result.substatus)
    },
})

let selectedPaymentMethod: PaymentMethodSelected | null = null

const views = transaction.getPaymentMethodsViews({
    types: ['paymentMethodList'],
    onPaymentSelected: (paymentMethod) => {
        selectedPaymentMethod = paymentMethod
    },
})

views.paymentMethodList?.mount({ elementSelector: '#root' })

// Your Pay button. With forms unfolded in the list, start() submits the form the shopper filled.
// With folded forms, start() mounts the form into #payment-form and the shopper pays from it.
document.getElementById('pay').addEventListener('click', () => {
    if (selectedPaymentMethod) transaction.start({ paymentMethod: selectedPaymentMethod })
})
```

## 变更内容

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

### 初始化和配置

| Full | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `window.Yuno.initialize(publicApiKey)` | `SdkPayments.initialize(publicApiKey)` | 重命名 | 全局对象是 `window.SdkPayments`。与之前一样，对其使用 `await`：它会解析为您用来创建交易的 `SdkPayments` 实例。 |
| `startCheckout` 配置中的 `checkoutSession`、`countryCode`、`language` | 交易配置中的相同字段 | 移动 | 字段相同，单一工厂方法：`sdkPayments.transaction({ checkoutSession, countryCode, language, … })`。 |
| `paymentListConfig` | 交易配置中的 `paymentListConfig` | 移动 | 结构相同，字段相同。 |
| `renderMode: { type, elementSelector }` | 交易配置中的 `elementSelector` | 移动 | 模态框模式已不再存在。在交易配置中设置 `elementSelector` 以渲染所选支付方式的表单。当 `start({ paymentMethod })` 渲染表单时它是必需的，headless 流程会忽略它。支付方式列表本身在您传给 `views.paymentMethodList.mount({ elementSelector })` 的 `elementSelector` 处渲染（请参阅“视图”）。 |
| `yuno.mountStatusPayment(...)` | `sdkPayments.transactionStatus({ checkoutSession, elementSelector })` | 重命名 | 请参阅[支付状态](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/web/status.md)。在交易内部，结果页面由 `showStatusScreen` 控制，其默认值为 `true`。设置 `showStatusScreen: false` 可通过 `onStatus` 自行渲染结果。 |

### Callback

| Full | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `yunoPaymentResult(status, subStatus?)` | `onStatus(result)` | 重命名 | 仍然是唯一的结果 callback，现在是交易配置中的一个字段。它接收一个带有 `.status`、`.substatus` 和 `.message` 的 `TransactionStatus` 对象。新 callback 的命名约定：覆盖项没有 `on` 前缀（`createPayment`、`showLoading`），观察者有该前缀（`onStatus`、`onPaymentSelected`）。请参阅 [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。 |
| `yunoCreatePayment(ott, info)` | `createPayment(token)` | 重命名 | 可选。基于 Promise，单个参数。创建支付，然后 resolve：resolve 即相当于过去的 `continuePayment()`。请参阅 [`createPayment`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/create-payment)。 |
| `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)。 |
| `yunoPaymentMethodSelected({ type, name })`（会话级通知） | `getPaymentMethodsViews` 内的 `onPaymentSelected(paymentMethod)` | 重命名 | 在类型中是可选的，但没有它，列表就无法发起支付。旧版 callback 只是一个通知。在统一 API 中，请保存它接收到的 [`PaymentMethodSelected`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-pass#payment-method-selected)，并通过您的 Pay 按钮将其传给 `transaction.start({ paymentMethod })`。当列表以内联方式打开了该支付方式的表单时，`start()` 会提交该表单。对于快捷钱包行，由钱包按钮完成支付，`start()` 不执行任何操作。 |

### 视图

| Full | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `yuno.startCheckout({ elementSelector: '#root' })` + `yuno.mountCheckout()` | `transaction.getPaymentMethodsViews({ types: ['paymentMethodList'], onPaymentSelected })`，然后 `views.paymentMethodList?.mount({ elementSelector: '#root' })` | 重命名 | `mountCheckout()` 过去在 `startCheckout` 的 `elementSelector` 处渲染列表。统一 API 会交给您一个视图句柄，您使用选择器以及每个视图的配置调用 `.mount(...)`。这样意图（“在此处渲染抽屉”）在调用位置一目了然。请参阅[支付方式列表](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/payment-methods-list.md)。 |

### 入口点

| Full | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `yuno.startCheckout(config)` | `sdkPayments.transaction(config)` | 重命名 | 单一工厂方法：使用配置（上述字段和 callback）构建交易，然后挂载列表（请参阅“视图”），并通过您的 Pay 按钮使用所选支付方式调用 `start`（请参阅“Callback”）。 |
| `yuno.continuePayment()` | *（已移除）* | 移除 | 删除该调用：一旦 `createPayment` resolve，SDK 会在内部编排 3DS 和状态轮询。 |

## 相关内容

* [支付方式列表](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/payment-methods-list.md)。各平台 `getPaymentMethodsViews` 的完整参考。
* [`TransactionConfig`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-pass#transaction-config)。完整的字段参考。
* [`PaymentMethodSelected`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-pass#payment-method-selected)。您传给 `start()` 的对象。


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