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

# React Native SDK

> 将 Yuno 集成到您的 React Native 应用中，以接受支付并保存支付方式。

> [!NOTE]
>
> **This page documents a legacy SDK.** Starting a new integration? Use the [Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md). Already on a legacy SDK? Follow the [migration guide](https://docs.y.uno/docs/yuno-sdk/migration/overview.md).
>
> The new **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) replaces the Full, Lite, Seamless, Render, Headless, and Secure Fields SDKs with one API across every platform. Legacy SDKs remain supported side by side during the transition and are scheduled for deprecation in **2027**. Contact your Account Manager for migration planning.

> [!WARNING]
>
> **Orientation: Choosing Your Integration Flow**, before you begin, please review the [Official Integration Flow](https://docs.y.uno/docs/sdks/overview/understanding-flows.md).
>
> * **Standard Flow ([Full Checkout](https://docs.y.uno/docs/sdks/full-checkout/web-payments))**: Recommended for most merchants. Yuno handles the UI, security, and automatic updates for payment methods.
> * **Custom Flow (This SDK)**: Use this only if you require full control over the UX. **Note**: You will be responsible for manually handling payment statuses, 3DS transitions, and fraud routing data collection.

Yuno React Native SDK 提供了一组组件和方法，用于将 Yuno 的支付功能集成到您的移动应用中。它同时支持 iOS 和 Android。

## 安装

```bash theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
npm install @yuno-payments/yuno-sdk-react-native@^1.5.0
```

**iOS 设置**：

```bash theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
cd ios && pod install
```

在 `ios/Podfile` 中设置 `platform :ios, '15.1'` 或更高版本。`pod install` 会通过 Swift Package Manager 将 `YunoSDK-Static` 2.31.0 添加到该包的 pod 中，因此应用本身无需添加 Yuno iOS SDK。

**要求**：

* react-native 0.75+
* Node.js 16+
* Android Min SDK 21
* iOS 15.1+

1.5.0 版本将这些最低要求从 React Native 0.70 和 iOS 14.0 提高到了上述版本。

该 SDK 开箱即包含 TypeScript 类型定义。

## 初始化

请在应用中尽早初始化 SDK，通常在 `App.tsx` 中进行。

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
import { useEffect } from 'react';

export default function App() {
  useEffect(() => {
    YunoSdk.initialize({
      apiKey: 'your-public-api-key',
      countryCode: 'US', // Default country
    });
  }, []);
  
  return <YourApp />;
}
```

## 基本支付流程（Full Checkout）

最简单的集成方式是使用 `YunoPaymentMethods` 组件显示可用的支付方式，并使用 `startPayment` 处理交易。

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { YunoSdk, YunoPaymentMethods } from '@yuno-payments/yuno-sdk-react-native';

export default function PaymentScreen() {
  const [checkoutSession, setCheckoutSession] = useState<string | null>(null);
  const [isReady, setIsReady] = useState(false);
  
  useEffect(() => {
    // 1. Subscribe to payment events
    const subscription = YunoSdk.onPaymentStatus((state) => {
      if (state.status === 'SUCCEEDED') {
        // Handle success
      }
    });
    
    // 2. Fetch checkout session from your backend
    createCheckoutSession().then(session => {
      setCheckoutSession(session);
      setIsReady(true);
    });
    
    return () => subscription.remove();
  }, []);
  
  const handlePayment = async () => {
    // 3. Start payment flow
    await YunoSdk.startPayment(true); // true = show payment status screen
  };
  
  return (
    <View>
      {checkoutSession && (
        <YunoPaymentMethods
          checkoutSession={checkoutSession}
          countryCode="US"
        />
      )}
      <Button title="Pay Now" onPress={handlePayment} disabled={!isReady} />
    </View>
  );
}
```

## 集成选项

请选择最适合您需求的集成级别：

> [card] [Lite SDK](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/lite.md)
>
> 由您控制支付方式选择界面，Yuno 负责处理支付流程。

> [card] [Headless SDK](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/headless.md)
>
> 构建完全自定义的界面，并手动处理支付流程。

> [card] [注册](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/enrollment.md)
>
> 允许客户保存其支付方式以供将来使用。

> [card] [样式](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/styling.md)
>
> 自定义 SDK 组件的外观，使其与您的品牌相匹配。

## 后续步骤

* 查看[代码示例](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/code-examples.md)，了解常见场景。
* 了解[高级功能](https://docs.y.uno/zh-hans/docs/sdks/additional-platforms/react-native/advanced-features.md)，例如深度链接和性能。


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