> ## 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 (Payment iOS)

> Integra el Lite SDK en iOS para una experiencia de checkout de pago con tarjeta optimizada

> [!NOTE]
>
> **Esta página documenta un SDK heredado.** ¿Vas a iniciar una nueva integración? Usa el [Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md). ¿Ya usas un SDK heredado? Sigue la [guía de migración](https://docs.y.uno/docs/yuno-sdk/migration/overview.md).
>
> El nuevo **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) reemplaza los SDK Full, Lite, Seamless, Render, Headless y Secure Fields con una sola API en todas las plataformas. Los SDK heredados siguen siendo compatibles en paralelo durante la transición y está previsto dejarlos de usar en **2027**. Contacta a tu Account Manager para planificar la migración.

> [!WARNING]
>
> **Orientación: elige tu flujo de integración**. Antes de comenzar, revisa el [flujo de integración oficial](https://docs.y.uno/docs/sdks/overview/understanding-flows.md).
>
> * **Flujo estándar ([Full Checkout](https://docs.y.uno/docs/sdks/full-checkout/web-payments))**: Recomendado para la mayoría de los comercios. Yuno se encarga de la interfaz, la seguridad y las actualizaciones automáticas de los métodos de pago.
> * **Flujo personalizado (este SDK)**: Úsalo solo si necesitas control total sobre la experiencia de usuario. **Nota**: Serás responsable de gestionar manualmente los estados de los pagos, las transiciones de 3DS y la recopilación de datos para el enrutamiento de fraude.

## Paso 1: incluye la biblioteca en tu proyecto

### CocoaPods

Agrega la siguiente línea a tu Podfile:

```ruby theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
pod 'YunoSDK', '~> 2.29.0'
```

### Swift Package Manager

Agrega `YunoSDK` como dependencia:

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

## Paso 2: inicializa el SDK

Inicializa el SDK con tu clave de API pública:

```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") }
)
```

## Paso 3: adopta YunoPaymentDelegate

Adopta el protocolo `YunoPaymentDelegate`:

> [!NOTE]
>
> **Requisitos de concurrencia en Swift 6**
>
> Si usas Swift 6, deberás implementar el protocolo `YunoPaymentDelegate` con consideraciones de concurrencia específicas. Consulta la guía [Concurrencia en Swift 6](https://docs.y.uno/es/docs/sdks/resources/swift-6-concurrency.md) para conocer las opciones de implementación y las mejores prácticas.

```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
    }
}
```

| Método | Descripción |
| :- | :- |
| `yunoCreatePayment(with:)` | Se llama cuando se genera un token de un solo uso. Crea el pago en tu backend. |
| `yunoCreatePayment(with:information:)` | Callback alternativo que también incluye información adicional sobre el token de un solo uso, como los datos de la tarjeta (BIN de DPAN, marca, últimos cuatro dígitos). Consulta [Información adicional del OTT](https://docs.y.uno/docs/sdks/full-checkout/ios-payments#ott-additional-information) para ver las claves disponibles. |
| `yunoPaymentResult(_:)` | Se llama cuando finaliza el proceso de pago. Recibe un valor `Yuno.Result`. |

> [!CAUTION]
>
> **Nota importante**
>
> Implementa `yunoCreatePayment(with:)` **o** `yunoCreatePayment(with:information:)`, no ambos. El SDK llama a cada versión que implementes, por lo que implementar ambos crea el pago dos veces.

## Paso 4: inicia el proceso de pago

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

## Paso 5: continúa el pago (obligatorio)

Si la API devuelve `sdk_action_required: true`, llama a:

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

> [!NOTE]
>
> **App de demostración**
>
> Consulta el [repositorio del SDK de Yuno para iOS](https://github.com/yuno-payments/yuno-sdk-ios) para ver ejemplos de implementación completos.


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