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

> 将 React Native 注册（YunoSdk.enrollmentPayment）迁移到统一 Transaction API。

`YunoSdk.enrollmentPayment` 会为客户会话打开 SDK 的注册表单，并通过 `onEnrollmentStatus` 报告结果。在统一 API 中，注册与支付是同一个 `Transaction`：传入 `customerSession` 而不是 `checkoutSession`，然后调用 `start()`。SDK 会展示表单、注册该支付方式，并通过 `onStatus` 报告结果。

## 开始之前

* 将 `@yuno-payments/yuno-sdk-react-native` 升级到 2.0.0 并运行 `pod install`。您的公共 API 密钥和您的 backend 创建的客户会话保持不变（[注册：开始之前](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/enrollment.md#before-you-start)）。
* 在 Android 上，`minSdkVersion` 现在为 23。如果您的 `android/build.gradle` 对 Yuno 模块应用了 Compose 编译器插件（1.x 的变通方案），请删除该代码块：使用 2.0.0 时，构建会失败并报错“The Compose Compiler requires the Compose Runtime to be on the class path”。
* 无需创建支付：注册期间不会调用 `createPayment`。

## 代码对照

```tsx Before. Lite enrollment theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { YunoSdk, YunoStatus } from '@yuno-payments/yuno-sdk-react-native';

const subscription = YunoSdk.onEnrollmentStatus((state) => {
  if (state.status === YunoStatus.SUCCEEDED) {
    console.log('Card saved');
  }
});

await YunoSdk.enrollmentPayment({
  customerSession,
  countryCode: 'CO',
  showPaymentStatus: true,
});

// When the screen goes away
subscription.remove();
```

```tsx After. Unified Transaction theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { Transaction } from '@yuno-payments/yuno-sdk-react-native';

const enrollment = new Transaction({
  customerSession,
  countryCode: 'CO',
  showStatusScreen: true,
  controller: {
    onStatus: (status) => {
      if (status.status === 'ENROLLED') {
        console.log('Card saved');
      }
    },
  },
});

await enrollment.start({ type: 'CARD' });

// When the screen goes away
enrollment.dispose();
```

## 变更内容

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

### 初始化和配置

| Lite 注册 | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `YunoSdk.initialize({ apiKey, countryCode, yunoConfig })` | `SdkPayments.initialize(apiKey)` | 重命名 | 现在它只接收密钥。`countryCode` 和 `language` 移至 `TransactionConfig`。 |
| `enrollmentPayment` 的 `customerSession` | `TransactionConfig.customerSession` | 移动 | 会话类型决定了该交易是一次注册。不要同时传入 `checkoutSession`：构造函数会抛出异常。 |
| `enrollmentPayment` 的 `countryCode` | `TransactionConfig.countryCode` | 移动 | |
| `enrollmentPayment` 的 `showPaymentStatus` | `TransactionConfig.showStatusScreen` | 移动 | 现在默认关闭：设置 `showStatusScreen: true` 以保留 SDK 结果页面。 |

### 控制器

| Lite 注册 | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `YunoSdk.onEnrollmentStatus((state) => …)` | `onStatus(status)` | 重命名 | 在配置的 `controller` 中实现它；无需移除任何订阅。`status` 和 `substatus` 来自 backend：成功的注册报告 `ENROLLED`，而不是 1.x 的 `SUCCEEDED`，并且 `USER_CANCEL` 取代了 `CANCELLED_BY_USER`。SDK 自身只发出 `INTERNAL_ERROR` 和 `USER_CANCEL`。参见 [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。 |
| *（无）* | `showView(view, process, step)` | 新增 | 可选。使用 `<YunoView>` 将注册表单嵌入您自己的界面，并通过 `process.onSubmit()` 从您自己的按钮提交。参见 [`showView`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-view)。 |
| *（无）* | `showLoading(isLoading)` | 新增 | 可选。显示您自己的加载指示器。参见 [`showLoading`](https://docs.y.uno/zh-hans/docs/yuno-sdk/controllers/show-loading)。 |

### 入口点

| Lite 注册 | 统一 API | 变更 | 操作 |
| - | - | - | - |
| `YunoSdk.enrollmentPayment({ customerSession, countryCode, showPaymentStatus })` | `new Transaction(config).start(paymentSelected)` | 重命名 | 使用客户会话构建配置，然后使用要注册的支付方式调用 `start`，例如 `{ type: 'CARD' }`。 |

> [!NOTE]
>
> 存储令牌不会返回给应用。收到成功状态后，请通过您 backend 的列出客户支付方式 endpoint 获取它，并将其与您的客户关联存储。

## 相关内容

* [注册功能](https://docs.y.uno/zh-hans/docs/yuno-sdk/features/enrollment.md)。统一 API 的注册分步指南。
* [Headless 注册](https://docs.y.uno/zh-hans/docs/yuno-sdk/migration/react-native/enrollment/headless.md)。使用您自行收集的数据进行注册。
* [`Status`](https://docs.y.uno/zh-hans/docs/yuno-sdk/reference/objects-you-receive#status)。取值和 substatus。


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