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

# Lite 注册

> 将 iOS Lite 注册（Yuno.enrollPayment）迁移到统一的 Transaction API。

`Yuno.enrollPayment` 会完整运行注册流程：SDK 从客户会话中读取要注册的支付方式，并渲染表单和结果页面。统一 API 中的对应方式是 `Transaction.start(paymentSelected:)` 的默认行为。除 `onStatus` 外无需覆盖任何控制器方法。

## 开始之前

* 将 `import YunoSDK` 替换为 `import SdkPayments`。您的公共 API 密钥以及您的 backend 创建的客户会话保持不变（[开始之前](https://docs.y.uno/zh-hans/docs/yuno-sdk/get-started.md#before-you-begin)）。
* 无需创建支付：注册期间不会调用 `createPayment`，因此覆盖它不会产生任何效果。

## 对照

```swift Before. Lite enrollment theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import YunoSDK

Yuno.initialize(apiKey: "your-public-api-key")

final class EnrollmentModel: YunoEnrollmentDelegate {
    var customerSession: String = "session-from-backend"
    var countryCode: String = "CO"
    var language: String? = "en"
    var viewController: UIViewController?

    func yunoEnrollmentResult(_ result: Yuno.Result) {
        // result.status: .succeeded / .reject / .fail / etc.
    }

    func enroll() {
        Yuno.enrollPayment(with: self, showPaymentStatus: true)
    }
}
```

```swift After. Unified Transaction theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import SdkPayments

SdkPayments.initialize(apiKey: "your-public-api-key")

final class EnrollmentModel: SdkPayments.TransactionController {

    func onStatus(status: SdkPayments.TransactionStatus) {
        // status.status comes from the backend. See /reference/status.
    }

    func enroll() {
        let config = SdkPayments.TransactionConfig(
            customerSession: "session-from-backend",
            countryCode: "CO",
            language: "en",
            controller: self,
            showStatusScreen: true
        )

        let paymentSelected = SdkPayments.PaymentMethodSelected(
            paymentMethodType: "CARD"
        )

        SdkPayments.Transaction(config: config)
            .start(paymentSelected: paymentSelected)
    }
}
```

## 变更内容

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

### 初始化与配置

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `import YunoSDK` | `import SdkPayments` | 已重命名 | |
| `Yuno.initialize(apiKey:)` | `SdkPayments.initialize(apiKey:)` | 已重命名 | `callback:` 参数已移除；如需等待，请使用 `async` 重载。 |
| 在 `YunoConfig.appearance` 中传入的 `Yuno.Appearance` | `SdkPayments.TransactionConfig.appearance` 中的 `SdkPayments.Appearance` | 已重命名 | 初始化器相同；去掉 `Yuno.` 前缀，并按每笔交易传入，而不是在启动时传入一次。 |
| `YunoEnrollmentDelegate.customerSession` | `SdkPayments.TransactionConfig.customerSession` | 已移动 | 委托属性变为配置字段。与 `checkoutSession` 互斥。 |
| `YunoEnrollmentDelegate.countryCode`、`.language`、`.viewController` | `SdkPayments.TransactionConfig` 上的相同字段 | 已移动 | 委托属性变为配置字段。`viewController` 仍仅适用于 iOS，在 SwiftUI 中为可选。 |
| `enrollPayment` 的 `showPaymentStatus:` 参数 | `SdkPayments.TransactionConfig.showStatusScreen` | 已移动 | 请参阅下方说明。 |
| *（无）* | `SdkPayments.PaymentMethodSelected` | 新增 | `start` 需要它。传入创建客户会话时使用的 `paymentMethodType`：与之前一样，实际注册的支付方式由会话决定。 |

> [!NOTE]
>
> **SDK 结果页面现在默认关闭。** 设置 `showStatusScreen: true` 即可保留它。

### 控制器

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `YunoEnrollmentDelegate` | `SdkPayments.TransactionController` | 已重命名 | 让同一个类遵循该协议，并将其作为 `TransactionConfig.controller` 传入。与之前一样，SDK 不会持有它：请在整个交易期间保持其存活。 |
| `yunoEnrollmentResult(_:)` | `onStatus(status:)` | 已重命名 | 仍是唯一的结果 callback，每笔交易调用一次，SDK 显示其结果页面时也会调用。`status` 和 `substatus` 来自 backend；SDK 本身只会发出 `INTERNAL_ERROR` 和 `USER_CANCEL`。请参阅 [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。 |
| `onLoading(isLoading:)` | `showLoading(isLoading:)` | 已重命名 | 两者均为可选。Lite 注册从未调用它：SDK 始终显示自己的加载指示器。除非您覆盖 `showLoading`，否则仍是如此；覆盖后，SDK 会隐藏自己的加载指示器，并将状态报告给您。请参阅 [`showLoading`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-loading)。 |

### 入口点

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `Yuno.enrollPayment(with:showPaymentStatus:)` | `SdkPayments.Transaction(config:).start(paymentSelected:)` | 已重命名 | 构建配置和 `PaymentMethodSelected`，然后调用 `start`。SDK 仍不会渲染可注册支付方式的列表。 |
| `Yuno.receiveDeeplink(_:)` | `SdkPayments.handleDeeplink(_:)` | 已重命名 | 作用相同：转发您的应用在外部重定向后收到的 URL。请参阅 [处理 deeplink](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/handle-deeplinks.md)。 |

## 相关内容

* [注册功能](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/enrollment.md)。统一 API 注册的完整演练。
* [Render 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/ios/enrollment/render.md)。自行嵌入表单。
* [Headless 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/ios/enrollment/headless.md)。在您自己的 UI 中收集数据。
* [`TransactionConfig`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-pass#transaction-config)。完整的字段参考（包括 `customerSession`）。


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