> ## 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 注册

> 将 Android Lite 注册（Activity.startEnrollment）迁移到统一 Transaction API。

`startEnrollment` 以端到端方式运行注册流程：商户选择支付方式，SDK 渲染表单和结果页面。统一 API 中的等效写法是 `Transaction.start(activity = this, paymentSelected = PaymentMethodSelected(paymentMethodType = "<type>"))`：无需 `transactionData`，SDK 会为该类型渲染表单。除 `onStatus` 外无需覆盖任何控制器。

## 开始之前

* 将 `com.yuno.sdk.*` 导入替换为对应的 `com.yuno.payments.sdk.api.*` 导入（“代码对照”一节已列出）。您的公共 API 密钥和您的 backend 创建的客户会话保持不变（[开始之前](https://docs.y.uno/zh-hans/docs/yuno-sdk/get-started.md#before-you-begin)）。
* 无需创建支付：注册期间不会调用 `createPayment`，因此覆盖它不会产生任何效果。

## 代码对照

```kotlin Before. Lite enrollment theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import com.yuno.sdk.Yuno
import com.yuno.sdk.enrollment.initEnrollment
import com.yuno.sdk.enrollment.startEnrollment

class EnrollmentActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        Yuno.initialize(applicationContext, apiKey = "your-public-api-key")

        initEnrollment { state ->
            // state: "SUCCEEDED" / "REJECT" / "FAIL" / "PROCESSING" / "INTERNAL_ERROR" / "CANCELED"
        }
    }

    fun enroll() {
        startEnrollment(
            customerSession = "session-from-backend",
            countryCode = "CO",
            showEnrollmentStatus = true,
        )
    }
}
```

```kotlin After. Unified Transaction theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import com.yuno.payments.sdk.api.SdkPayments
import com.yuno.payments.sdk.api.Transaction
import com.yuno.payments.sdk.api.TransactionConfig
import com.yuno.payments.sdk.api.TransactionController
import com.yuno.payments.sdk.api.models.PaymentMethodSelected
import com.yuno.payments.sdk.api.models.TransactionStatus

class EnrollmentActivity : ComponentActivity(), TransactionController {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        SdkPayments.initialize(applicationContext, apiKey = "your-public-api-key")
    }

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

    fun enroll() {
        val config = TransactionConfig(
            customerSession = "session-from-backend",
            countryCode = "CO",
            language = "en",
            controller = this,
            showStatusScreen = true,
        )

        Transaction(config = config)
            .start(activity = this, paymentSelected = PaymentMethodSelected(type = "CARD"))
    }
}
```

## 变更内容

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

### 初始化和配置

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `import com.yuno.sdk.*` | `import com.yuno.payments.sdk.api.*` | 重命名 | |
| `Yuno.initialize(context, apiKey)` | `SdkPayments.initialize(context, apiKey)` | 重命名 | 它会保留应用上下文：之后的调用都不接收 `Context` 参数。 |
| `startEnrollment` 的 `customerSession` 参数 | `TransactionConfig.customerSession` | 移动 | 该参数变为配置字段。与 `checkoutSession` 互斥。 |
| `startEnrollment` 的 `countryCode` 参数 | `TransactionConfig.countryCode` | 移动 | 该参数变为配置字段。 |
| `YunoConfig.styles` / `YunoConfig.language` | `TransactionConfig.appearance` / `TransactionConfig.language` | 移动 | 按每笔交易传入，而不是在启动时传入一次。 |
| `startEnrollment` 的 `showEnrollmentStatus` 参数 | `TransactionConfig.showStatusScreen` | 移动 | 作用相同。 |
| *（无）* | `PaymentMethodSelected` | 新增 | 使用要注册的 `type` 构建它并传给 `start`：`paymentSelected` 始终不为 null。 |

### 控制器

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| 传给 `initEnrollment` 的 lambda（`callbackEnrollmentState`） | `TransactionController` | 重命名 | lambda 变为接口：实现 `TransactionController` 并将其作为 `TransactionConfig.controller` 传入。SDK 不会保留它：请在整个交易期间保持其存活。 |
| `callbackEnrollmentState: (String?) -> Unit` | `onStatus(status: TransactionStatus)` | 重命名 | 仍是唯一的结果 callback，每笔交易触发一次，SDK 显示其结果页面时也是如此。原始状态字符串变为 `TransactionStatus` 对象：`status` 和 `substatus` 从 backend 透传；SDK 自身只发出 `INTERNAL_ERROR` 和 `USER_CANCEL`。参见 [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。 |

### 入口点

| Lite | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `initEnrollment(callback)` + `startEnrollment(customerSession, countryCode, showEnrollmentStatus)` | `Transaction(config).start(activity, paymentSelected)` | 重命名 | 先构建配置，再调用 `start`。与以前一样，由您选择支付方式：通过 `paymentMethodType` 传入。SDK 不会渲染可注册支付方式的列表。 |

## 相关内容

* [注册功能](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/enrollment.md)。统一 API 的注册分步指南。
* [Render 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/android/enrollment/render.md)。自行嵌入表单。
* [Headless 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/android/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.