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

# Render 注册

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

Render 注册让您可以将 SDK 的注册表单嵌入到您自己的布局中。您会获得一个 `YunoEnrollmentRenderFlowProtocol`，向它请求 `formView`，并从您自己的按钮调用 `submitForm()`。它还提供了 `needSubmit: Bool`，用于告诉您表单是否需要提交按钮。

在统一 API 中，同样的模式通过覆盖 [`showView`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-view) 来实现：SDK 会连同一个 `TransactionProcess` 一起交付表单视图，您在该对象上调用 `onSubmit()`。

## 开始之前

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

## 对照

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

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

    func yunoEnrollmentResult(_ result: Yuno.Result) { /* ... */ }
    func onLoading(isLoading: Bool) { /* show your own loader */ }
}

struct EnrollmentView: View {
    @StateObject var model = EnrollmentModel()
    @State var enrollmentFlow: YunoEnrollmentRenderFlowProtocol?
    @State var formView: AnyView?

    var body: some View {
        VStack {
            formView
            if enrollmentFlow?.needSubmit == true {
                Button("Enroll") {
                    enrollmentFlow?.submitForm()
                }
            }
        }
        .task {
            enrollmentFlow = Yuno.startEnrollmentRender(with: model)
            formView = await enrollmentFlow?.formView(with: model)
        }
    }
}
```

```swift After. showView override theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import SwiftUI
import SdkPayments

final class EnrollmentModel: SdkPayments.TransactionController, ObservableObject {

    @Published var formView: AnyView?
    @Published var process: SdkPayments.TransactionProcess?
    @Published var isLoading: Bool = false

    func showView(view: AnyView?, process: SdkPayments.TransactionProcess, step: SdkPayments.TransactionViewStep) {
        self.formView = view
        self.process = process
    }

    func showLoading(isLoading: Bool) { self.isLoading = isLoading }

    func onStatus(status: SdkPayments.TransactionStatus) { /* ... */ }
}

struct EnrollmentView: View {
    @StateObject var model = EnrollmentModel()

    var body: some View {
        VStack {
            if model.isLoading { ProgressView() }
            model.formView
            Button("Enroll") {
                model.process?.onSubmit()
            }
        }
        .task {
            let config = SdkPayments.TransactionConfig(
                customerSession: "session-from-backend",
                countryCode: "CO",
                controller: model
            )

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

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

## 变更内容

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

### 初始化与配置

| Render | 统一 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`、`.countryCode`、`.language`、`.viewController` | `SdkPayments.TransactionConfig` 上的相同字段 | 已移动 | 委托属性变为配置字段。`viewController` 仍仅适用于 iOS，在 SwiftUI 中为可选。 |
| *（无）* | `SdkPayments.PaymentMethodSelected` | 新增 | `start` 需要它。传入创建客户会话时使用的 `paymentMethodType`：与之前一样，实际注册的支付方式由会话决定。 |

### 控制器

| Render | 统一 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)。 |
| `YunoEnrollmentRenderFlowProtocol.formView(with:) async -> AnyView?` | `showView(view:process:step:)` | 已重命名 | 推送而非拉取：视图就绪时，SDK 会将其连同您用于提交的 `TransactionProcess` 一起交付给您的处理程序（请参阅“视图”）。请参阅 [`showView`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-view)。 |
| `YunoLoaderDelegate.onLoading(isLoading:)` | `showLoading(isLoading:)` | 已重命名 | 可选。仅在被覆盖时触发：此时 SDK 会隐藏自己的加载指示器，并将状态报告给您。请参阅 [`showLoading`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-loading)。 |

### 视图

| Render | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `YunoEnrollmentRenderFlowProtocol.submitForm()` | `process.onSubmit()` | 已重命名 | 作用相同。在您在 `showView` 中收到的 `TransactionProcess` 上，从您自己的按钮调用它。 |
| `YunoEnrollmentRenderFlowProtocol.needSubmit` | *（已移除）* | 已移除 | 统一 API 中没有对应项：您需要渲染自己的提交按钮。如果需要为不需要提交的表单隐藏该按钮，请通过您自己的状态来控制（例如，检查传递给 `showView` 的 `step`）。 |
| *（无）* | `SdkPayments.defaultShowView(view:process:step:)` | 新增 | 对于您不想嵌入的步骤，请从您的 `showView` 覆盖中调用它（例如，嵌入 `.FORM`，并将 `.ACTION` 交还给 SDK）。 |

### 入口点

| Render | 统一 API | 变更 | 操作 |
| - | - | - | - |
| 返回 `YunoEnrollmentRenderFlowProtocol` 的 `Yuno.startEnrollmentRender(with:)` | `SdkPayments.Transaction(config:).start(paymentSelected:)` + 覆盖 `showView` | 已重命名 | 构建配置和 `PaymentMethodSelected`，然后调用 `start`。不会返回任何内容：视图就绪时会通过 `showView` 送达。 |
| `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 注册的完整演练。
* [Lite 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/ios/enrollment/lite.md)。由 SDK 驱动，无需嵌入视图。
* [Headless 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/ios/enrollment/headless.md)。在您自己的 UI 中收集数据。
* [`showView`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-view)。您在此处覆盖的控制器方法。


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