> ## 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 SDK（iOS 支付）

> 在 iOS 上集成 Lite SDK，获得简化的卡支付 checkout 体验

> [!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.

## 第 1 步：在项目中引入库

### Swift Package Manager

YunoSDK 已不再在 CocoaPods 上发布；最后一个 CocoaPods 版本是 2.30.0。将该包添加为依赖项：

```swift theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
.package(url: "https://github.com/yuno-payments/yuno-sdk-ios.git", .upToNextMajor(from: "2.31.0"))
```

将 `YunoSDK`（动态）或 `YunoSDK-Static`（静态，即 CocoaPods 所提供的版本）添加到您的应用 target 中，切勿同时添加两者。

## 第 2 步：初始化 SDK

使用您的公共 API 密钥初始化 SDK：

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

Yuno.initialize(
    apiKey: "PUBLIC_API_KEY",
    config: YunoConfig(),
    callback: { print("Yuno SDK initialized") }
)
```

## 第 3 步：采用 YunoPaymentDelegate

采用 `YunoPaymentDelegate` 协议：

> [!NOTE]
>
> **Swift 6 并发要求**
>
> 如果您使用 Swift 6，则需要在实现 `YunoPaymentDelegate` 协议时考虑特定的并发事项。有关详细的实现选项和最佳实践，请参阅 [Swift 6 并发](https://docs.y.uno/zh-hans/docs/sdks/resources/swift-6-concurrency.md)指南。

```swift theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
class ViewController: UIViewController, @preconcurrency YunoPaymentDelegate {
    var checkoutSession: String { "checkout_session" }
    var countryCode: String { "US" }
    var viewController: UIViewController? { self }

    func yunoCreatePayment(with token: String) {
        // Call your backend to create a payment
    }

    func yunoCreatePayment(with token: String, information: [String: Any]) {
        // Call your backend to create a payment using the additional token information
    }

    func yunoPaymentResult(_ result: Yuno.Result) {
        // Handle final payment state
    }
}
```

| 方法 | 说明 |
| :- | :- |
| `yunoCreatePayment(with:)` | 生成一次性令牌时调用。请在您的 backend 上创建支付。 |
| `yunoCreatePayment(with:information:)` | 替代 callback，还包含有关一次性令牌的附加信息，例如卡数据（DPAN BIN、卡品牌、卡号后四位）。有关可用的键，请参阅 [OTT 附加信息](https://docs.y.uno/docs/sdks/full-checkout/ios-payments#ott-additional-information)。 |
| `yunoPaymentResult(_:)` | 支付流程完成时调用。接收一个 `Yuno.Result` 值。 |

> [!CAUTION]
>
> **重要提示**
>
> 请实现 `yunoCreatePayment(with:)` **或** `yunoCreatePayment(with:information:)` 其中之一，不要同时实现两者。SDK 会调用您实现的每个版本，因此同时实现两者会导致支付被创建两次。

## 第 4 步：发起支付流程

```swift theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
Yuno.startPaymentLite(
    with: self,
    paymentSelected: paymentSelected,
    showPaymentStatus: true
)
```

## 第 5 步：继续支付（必需）

如果 API 返回 `sdk_action_required: true`，请调用：

```swift theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
Yuno.continuePayment()
```

> [!NOTE]
>
> **演示应用**
>
> 有关完整的实现示例，请参阅 [Yuno iOS SDK 代码仓库](https://github.com/yuno-payments/yuno-sdk-ios)。


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