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

> Integre o Lite SDK no iOS para uma experiência de checkout simplificada com pagamento por cartão

> [!NOTE]
>
> **Esta página documenta um SDK legado.** Vai começar uma nova integração? Use o [Yuno SDK](https://docs.y.uno/pt-br/docs/yuno-sdk/get-started.md). Já usa um SDK legado? Siga o [guia de migração](https://docs.y.uno/pt-br/docs/yuno-sdk/migration/overview.md).
>
> O novo **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) substitui os SDKs Full, Lite, Seamless, Render, Headless e Secure Fields por uma única API em todas as plataformas. Os SDKs legados continuam com suporte em paralelo durante a transição, e a descontinuação deles está prevista para **2027**. Entre em contato com o seu Account Manager para planejar a migração.

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

## Etapa 1: Inclua a biblioteca no seu projeto

### Swift Package Manager

O YunoSDK não é mais publicado no CocoaPods; a última versão no CocoaPods é a 2.30.0. Adicione o pacote como dependência:

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

Adicione `YunoSDK` (dinâmico) ou `YunoSDK-Static` (estático, o que o CocoaPods distribuía) ao target do seu app, nunca os dois.

## Etapa 2: Inicialize o SDK

Inicialize o SDK com a sua chave 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") }
)
```

## Etapa 3: Adote o YunoPaymentDelegate

Adote o protocolo `YunoPaymentDelegate`:

> [!NOTE]
>
> **Requisitos de concorrência do Swift 6**
>
> Se você usa o Swift 6, precisa implementar o protocolo `YunoPaymentDelegate` com considerações específicas de concorrência. Veja o guia [Concorrência no Swift 6](https://docs.y.uno/pt-br/docs/sdks/resources/swift-6-concurrency.md) para conhecer as opções de implementação detalhadas e as boas práticas.

```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 | Descrição |
| :- | :- |
| `yunoCreatePayment(with:)` | Chamado quando um token de uso único é gerado. Crie o pagamento no seu backend. |
| `yunoCreatePayment(with:information:)` | Callback alternativo que também inclui informações adicionais sobre o token de uso único, como dados do cartão (BIN do DPAN, bandeira, últimos quatro dígitos). Veja [Informações adicionais do OTT](https://docs.y.uno/docs/sdks/full-checkout/ios-payments#ott-additional-information) para conhecer as chaves disponíveis. |
| `yunoPaymentResult(_:)` | Chamado quando o processo de pagamento termina. Recebe um valor `Yuno.Result`. |

> [!CAUTION]
>
> **Observação importante**
>
> Implemente `yunoCreatePayment(with:)` **ou** `yunoCreatePayment(with:information:)`, não os dois. O SDK chama todas as versões que você implementa, então implementar as duas cria o pagamento duas vezes.

## Etapa 4: Inicie o processo de pagamento

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

## Etapa 5: Continue o pagamento (obrigatório)

Se a API retornar `sdk_action_required: true`, chame:

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

> [!NOTE]
>
> **App de demonstração**
>
> Veja o [repositório do Yuno iOS SDK](https://github.com/yuno-payments/yuno-sdk-ios) para exemplos completos de implementação.


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