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

# Android Payments

> Integrate full-checkout payment flows on Android, from checkout session creation through payment status handling

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

The Android SDK makes it easy to integrate payment flows into your Android app.

## Additional resources

* Access the [Release notes](https://docs.y.uno/changelog/android.md) or the [Yuno Android SDK repository](https://github.com/yuno-payments/yuno-sdk-android) to verify the latest SDK version available.

## Requirements

* **Minimum SDK Version**: `minSdkVersion` 23 or above (Android 6.0). Required since Yuno Android SDK 2.24.0
* **Java**: Java 8 enabled
* **AndroidX**: Use AndroidX instead of older support libraries
* **Android Gradle Plugin**: 4.0.0 or above
* **ProGuard**: 6.2.2 or above
* **Kotlin Gradle Plugin**: 1.4.0 or above
* **ELF Page Size Support**: Compliant with Google's 16 KB ELF page alignment requirements (Android 15 / ARMv9 ready)

### ProGuard / R8 Configuration

If your project has `minifyEnabled = true`, add these rules to your `proguard-rules.pro` file to ensure the SDK works correctly, especially with **AGP 8.x+ R8 full mode**.

> [accordion] Official Yuno ProGuard / R8 rules
>
> ```proguard theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> # Preserve generic type signatures and annotations
> -keepattributes Signature
> -keepattributes *Annotation*
>
> # Yuno SDK
> -keep class com.yuno.** { *; }
> -dontwarn com.yuno.**
>
> # Gson — R8 full mode compatibility
> -keep class com.google.gson.** { *; }
> -keep,allowobfuscation,allowshrinking,allowoptimization class * extends com.google.gson.reflect.TypeToken
> -dontwarn com.google.gson.**
>
> # Retrofit — R8 full mode compatibility
> -keep,allowobfuscation,allowshrinking interface retrofit2.Call
> -keep,allowobfuscation,allowshrinking class retrofit2.Response
> -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
> -dontwarn retrofit2.**
>
> # OkHttp + Okio — Suppress warnings
> -dontwarn okhttp3.**
> -dontwarn okio.**
> ```
>
> ### Why are these rules necessary?
>
> AGP 8.x+ enables **R8 full mode** by default, which aggressively strips generic type signatures. Without `-keepattributes Signature`, Gson’s `TypeToken<T>` can fail at runtime with `java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType`.

## Include the library in your project

The first step is including the library in your project. Add the Yuno Android SDK to your project through Gradle. Add the repository source and dependency:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
maven { url "https://yunopayments.jfrog.io/artifactory/snapshots-libs-release" }
```

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
dependencies {
    implementation 'com.yuno.payments:android-sdk:2.27.0'
}
```

Once Step 1 is complete, continue with the full-checkout integration.

## Parameters

For the full list of parameters and YunoConfig details, see the [Android SDK Common Reference](https://docs.y.uno/docs/sdks/resources/references/android.md).

| Parameter | Description |
| - | - |
| `checkoutSession` | Checkout session ID from your backend (Create checkout session API). Required. |
| `countryCode` | ISO country code (e.g. `US`). Required. |
| `callbackPaymentState` | Callback `(state, subState, message)`: payment state (e.g. SUCCEEDED, FAIL, PROCESSING, REJECT), its sub-state and, on error outcomes, a [`StatusMessage?`](https://docs.y.uno/docs/sdks/resources/references/android#statusmessage-error-details). Third parameter added in SDK `2.22.0`. |
| `merchantSessionId` | Optional merchant session identifier. |
| `onInstallmentSelected` | Optional callback fired when the shopper selects an installment option in the card form. See [Installment selection callback](#installment-selection-callback-oninstallmentselected). Available from SDK `2.20.0`. |
| `YunoConfig` (initialize) | Optional: saveCardEnabled, keepLoader, language, styles. See Common Reference. |

## full-checkout

Implement Full (Android): customizable UI, payment method management, fraud prevention, and checkout flows. More feature-rich than Headless, which focuses on core payment processing. See [Requirements](#requirements) above.

### Step 1: Include the library in your project

Follow the steps in [Include the library in your project](#include-the-library-in-your-project) above.

### Step 2: Initialize SDK with the public key

Retrieve your public API keys from the [Yuno Dashboard](https://dashboard.y.uno/).

If you haven't implemented a custom application, create one. In the `onCreate()` method of your application class, call the initialize function (`Yuno.initialize`):

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
class CustomApplication : Application() {
  override fun onCreate() {
    super.onCreate()
    Yuno.initialize(
      this,
      "<your-public-api-key>",
      config = YunoConfig(
        keepLoader = true,
      ),
    )
  }
}
```

See the [credentials page](https://docs.y.uno/reference/getting-started/authentication.md) for more information. Use the data class `YunoConfig` to customize the SDK's behavior. Include this configuration when calling `Yuno.initialize()`. The available options are:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
data class YunoConfig(
    val saveCardEnabled: Boolean = false,
    val keepLoader: Boolean = false,
    val language: YunoLanguage? = null,
    val styles: YunoStyles? = null
)
```

> [!WARNING]
>
> **cardFlow removed from YunoConfig**
>
> Starting from version **2.11.0**, `cardFlow` is no longer part of `YunoConfig`. Card flow configuration is now handled exclusively through the **CheckoutBuilder**. If you are migrating from an earlier version, remove `cardFlow` from your `YunoConfig` and configure it in the CheckoutBuilder instead.

### YunoConfig options

Customization options:

| customization option | Description |
| :- | :- |
| `saveCardEnabled` | Enables the Save card checkbox on card flows. Check the Save card section for more information. |
| `keepLoader` | When `true`, the SDK loader persists from OTT generation until `continuePayment()` is called. For details, see [keepLoader Parameter](https://docs.y.uno/docs/sdks/resources/references/android.md#keeploader-parameter). |
| `language` | Defines the language to be used in the payment forms. You can set it to one of the available language options: <ul><li>ar (Arabic)</li><li>es (Spanish)</li><li>en (English)</li><li>pt (Portuguese)</li><li>fil (Filipino)</li><li>id (Indonesian)</li><li>ms (Malay)</li><li>th (Thai)</li><li>zh-TW (Chinese (Traditional, Taiwan))</li><li>zh-CN (Chinese (Simplified, China))</li><li>vi (Vietnamese)</li><li>fr (French)</li><li>pl (Polish)</li><li>it (Italian)</li><li>de (German)</li><li>ru (Russian)</li><li>tr (Turkish)</li><li>nl (Dutch)</li><li>sv (Swedish)</li><li>ko (Korean)</li><li>ja (Japanese)</li><li>hi (Hindi)</li><li>bn (Bengali)</li><li>ml (Malayalam)</li><li>ur (Urdu)</li></ul> |
| `styles` | Enables SDK-wide UI customization. Use it to define global visual styles like font family and button appearance (color, padding, radius, typography) through a `YunoStyles` object. For more information, check the styles section. |

Update your manifest to use your application:

```xml theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
<application android:name=".CustomApplication"></application>
```

### Step 3: Create the checkout session

Each payment requires a new `checkout_session`. Use the [Create checkout session](https://docs.y.uno/reference/checkout-sessions/create-checkout-session.md) endpoint to create one; use that session to initiate the payment.

If your payment flow sends users to an external browser (e.g., for 3DS authentication or bank redirects), set the `callback_url` when creating your checkout session. See [Handle external browser return (callback\_url)](#step-3-create-the-checkout-session) for details.

### Step 4: Start the checkout process

Call the `startCheckout` method inside the `onCreate()` function of the activity that initializes the SDK to start a new payment process with Full (Android):

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
startCheckout(
  checkoutSession: "checkout_session",
  countryCode: "country_code_iso",
  callbackPaymentState: ((String?, String?, StatusMessage?) -> Unit)? = null,
  merchantSessionId: String? = null,
  onInstallmentSelected: ((InstallmentSelected?) -> Unit)? = null
)
```

See [Parameters](#parameters). The following are the possible states returned by the `callbackPaymentState`:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const val PAYMENT_STATE_SUCCEEDED = "SUCCEEDED"
const val PAYMENT_STATE_FAIL = "FAIL"
const val PAYMENT_STATE_PROCESSING = "PROCESSING"
const val PAYMENT_STATE_REJECT = "REJECT"
const val PAYMENT_STATE_INTERNAL_ERROR = "INTERNAL_ERROR"
const val PAYMENT_STATE_STATE_CANCELED_BY_USER = "CANCELED_BY_USER"
```

Possible states:

| **State** | **Description** | **Additional action required** |
| - | - | - |
| `SUCCEEDED` | The transaction or payment process was successfully completed without any errors. | No. |
| `FAIL` | The transaction failed due to errors such as data validation issues, server connection failures, or technical/network problems. | Yes. Investigate the cause of failure (validation, network, server) and take corrective measures. |
| `PROCESSING` | The transaction is currently in progress, awaiting approval or verification. | No. |
| `REJECT` | The transaction was rejected due to reasons like insufficient funds or suspected fraudulent activity. | Yes. Inform the user of the rejection, provide the reason if possible, and suggest actions. |
| `INTERNAL_ERROR` | An unexpected internal error occurred within the system handling the payment process. | Yes. Requires technical intervention to review the system, fix internal issues, and retry or inform the user. |
| `CANCELED_BY_USER` | The user voluntarily canceled the transaction or abandoned the payment process. | No. |

The callback receives three values: the state, its sub-state (the provider's detail, when any) and a `StatusMessage?` that is `null` on `SUCCEEDED`, `PROCESSING` and `CANCELED_BY_USER`, always present on `INTERNAL_ERROR`, and present on `REJECT` / `FAIL` when the backend returned a `response_code`:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
startCheckout(
  checkoutSession = "checkout_session",
  countryCode = "country_code_iso",
  callbackPaymentState = { state, subState, message ->
    when (state) {
      "SUCCEEDED" -> showSuccess()
      "REJECT", "FAIL" -> showDeclined(reason = message?.reason, code = message?.code)
      "INTERNAL_ERROR" -> reportSdkError(message)   // never null here
      else -> { }
    }
  },
)
```

See [StatusMessage (error details)](https://docs.y.uno/docs/sdks/resources/references/android.md#statusmessage-error-details) for the fields and when each one is populated.

#### Installment selection callback (`onInstallmentSelected`)

Available from SDK `2.20.0`. Register the optional `onInstallmentSelected` callback to keep your cart total in sync with the installment plan the shopper picks in the card form:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
startCheckout(
  checkoutSession = "checkout_session",
  countryCode = "country_code_iso",
  callbackPaymentState = { state, subState, message -> /* ... */ },
  onInstallmentSelected = { selection ->
    if (selection != null) {
      // Update your cart total, e.g. with selection.amount?.totalValue
    } else {
      // Installments are no longer available — restore your base total
    }
  },
)
```

The callback receives an `InstallmentSelected?` payload:

| Field | Type | Description |
| - | - | - |
| `installment` | `Int` | Number of installments selected (e.g. `3`). |
| `label` | `String` | The exact installment label rendered in the form, localized (e.g. `3x de R$875.00 - Total R$2,625.00`). |
| `amount` | `InstallmentAmount?` | `currency`, `value`, and `totalValue` as raw strings, exactly as reported by the installments plan. |
| `additionalData` | `Map<String, Any?>?` | Reserved for future use. Currently always `null`. |
| `isMerchantInstallment` | `Boolean?` | Reserved for the merchant-installments feature. Currently always `null` on Android. |

Firing semantics:

* Fires once when a default installment is pre-selected as the plan renders, so your total is correct from first paint.
* Fires on every selection the shopper makes.
* Fires with the recalculated default after the plan changes (for example, a BIN change).
* Fires once with `null` when installments stop being available after a selection was already reported (for example, the shopper switches to a card without installments) — restore your base total.
* Does not fire when the card form renders without installments, and registering no callback keeps the SDK behavior unchanged.
* The callback runs on the main thread. Exceptions thrown inside it are caught by the SDK and never interrupt the payment flow.

#### Payment status validation

This section explains how the SDK handles payment status when users cancel or leave payment flows, and how the SDK status relates to the backend payment status in these scenarios.

##### Sync payment methods (Google Pay)

For synchronous payment methods like Google Pay, when a user cancels or closes the wallet UI before a payment service provider (PSP) response is received:

* **SDK Status**: Returns `CANCELED_BY_USER`
* **Backend payment status**: Remains `PENDING` until PSP timeout or merchant cancellation
* **Important**: The SDK will not return `REJECT` or `PROCESSING` in this scenario

This ensures that the backend payment remains in a pending state and can be properly handled by the merchant's system.

##### Async payment methods (PIX and QR-based methods)

For asynchronous payment methods, when a user closes the payment window before completing the payment:

* **SDK Status**: Returns `CANCELED_BY_USER`\*.
* **Backend payment status**: Remains `PENDING` and the payment code remains valid until expiry.
* **Checkout session reuse**: Re-opening the same checkout session can display the same valid payment code.
* **No automatic cancellation**: The payment is not automatically cancelled on the backend when the user closes the window.
* **Confirming status**: `CANCELED_BY_USER` means the shopper left the screen, not that the payment failed. Confirm the final state via webhook or `GET /v1/payments/{payment_id}` before you show a cancellation.

> [!NOTE]
>
> \* Payment methods that show a payment code or voucher (PIX QR code, boleto, OXXO and similar), and Pix Parcelado, return `PROCESSING` with sub-status `CLOSED_BY_USER` instead of `CANCELED_BY_USER` when the user closes the screen. The payment stays `PENDING` on the backend and can still be completed.

##### Expired async payments

If a PIX QR code expires naturally:

* **Backend Status**: Updated to `EXPIRED`
* **SDK Status**: SDK callbacks and polling endpoints return `EXPIRED` consistently

This ensures merchants receive accurate status information when a payment method has expired.

### Step 5: Add the SDK view to the checkout

Use the `PaymentMethodListViewComponent` to display the available payment methods when implementing Full (Android) with Jetpack Compose. This component provides callbacks to notify your app when to enable or disable the pay button, and when an enrolled payment method is successfully removed.

#### Component signature

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
@Composable
fun PaymentMethodListViewComponent(
    activity: Activity,
    modifier: Modifier? = null,
    onPaymentSelected: (Boolean, PaymentSelected?) -> Unit,
    onUnEnrollSuccess: (Boolean) -> Unit = {},
    onSizeChanged: ((Dp, Dp) -> Unit)? = null
)
```

#### Component options

* `activity: Activity`: Current `Activity` where the component is hosted. Required for payment flows.
* `modifier: Modifier?` (optional): Layout and appearance (e.g. padding, spacing). Defaults to `null`.
* `onPaymentSelected: (Boolean, PaymentSelected?) -> Unit`: Invoked when a payment method is selected or deselected (`true` = method selected, enable pay button; `false` = none selected). The second argument describes the selected method.
* `onUnEnrollSuccess: (Boolean) -> Unit` (optional): Invoked when a stored payment method is successfully removed.
* `onSizeChanged: ((Dp, Dp) -> Unit)?` (optional): Invoked when the component's width and height change. Defaults to `null`.

#### Example

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
val coroutineScope = rememberCoroutineScope()
val snackbarHostState = remember { SnackbarHostState() }
var paymentMethodIsSelected by remember { mutableStateOf(false) }

Column(
    modifier = Modifier
        .weight(1f)
        .verticalScroll(rememberScrollState())
) {
    PaymentMethodListViewComponent(
        activity = activity,
        onPaymentSelected = { isSelected, _ ->
            paymentMethodIsSelected = isSelected
        },
        onUnEnrollSuccess = { success ->
            if (success) {
                coroutineScope.launch {
                    snackbarHostState.showSnackbar(
                        message = "Your payment method has been removed",
                    )
                }
            }
        },
    )
}
```

> [!CAUTION]
>
> **Important**
>
> Always wrap the component in a `Column` with `.verticalScroll(rememberScrollState())`. Without this, the list of payment methods may not render or scroll properly when there are multiple methods available.

### Step 6: Initiate the payment process

Call the `startPayment()` method to start a payment process:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
startPayment(
    showPaymentStatus: Boolean,
    callbackOTT: (String?) -> Unit = this::onTokenUpdated,
    callBackTokenWithInformation: (OneTimeTokenModel?) -> Unit = this::onTokenComplete
)

```

#### Options

Configure the payment with the following options:

| Parameter | Description |
| :- | :- |
| `showPaymentStatus` | A boolean that specifies whether the payment status should be displayed within the Yuno interface. |
| `callbackOTT` | A required function that returns the updated one-time token (OTT) needed to complete the payment process. This token is required to complete the payment. |
| `callBackTokenWithInformation` | A function that supplies detailed information about the one-time token, wrapped in a `OneTimeTokenModel` object, allowing for comprehensive handling of token details. |

#### OneTimeTokenModel

The `callBackTokenWithInformation` callback provides detailed information about the one-time token through the `OneTimeTokenModel` object:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
@Parcelize
data class OneTimeTokenModel(
    val token: String? = null,
    val vaultedToken: String? = null,
    val vaultOnSuccess: Boolean? = null,
    val type: String? = null,
    val cardData: CardInformationModel? = null,
    val customer: CustomerPayerInformationModel? = null,
) : Parcelable
```

**Card Information Model**

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
@Parcelize
data class CardInformationModel(
    val holderName: String? = null,
    val iin: String? = null,
    val lfd: String? = null,
    val numberLength: Int? = null,
    val securityCodeLength: Int? = null,
    val brand: String? = null,
    val type: String? = null,
    val category: String? = null,
    val issuerName: String? = null,
    val issuerCode: String? = null,
    val countryCode: String? = null,
) : Parcelable
```

**Customer Payer Information Model**

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
@Parcelize
data class CustomerPayerInformationModel(
    val name: String? = null,
    val lastName: String? = null,
    val email: String? = null,
    val document: Document? = null,
    val phone: Phone? = null,
    val address: Address? = null,
    val deviceFingerPrint: String? = null,
    val thirdPartySessionId: String? = null,
) : Parcelable
```

**Supporting Models**

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
@Parcelize
data class Document(
    val documentNumber: String? = null,
    val documentType: String? = null,
) : Parcelable

@Parcelize
data class Phone(
    val number: String,
    val countryCode: String,
) : Parcelable

@Parcelize
data class Address(
    val addressLine1: String? = null,
    val addressLine2: String? = null,
    val country: String? = null,
    val city: String? = null,
    val state: String? = null,
    val zipCode: String? = null,
    val neighborhood: String? = null,
) : Parcelable
```

### Step 7: Get the one-time token (OTT)

After the customer fills out the requested data in Yuno's payment forms, you will obtain the one-time token, a required parameter to create a payment using the Yuno API.

The one-time token will be shared by Yuno using the `callbackOTT` function you provided in Step 6 when initiating the payment. The one-time token will be available in the `onActivityResult`.

A loader can be shown while the one-time token is generated. Use Yuno's default or implement your own with the required configuration.

### Step 8: Create the payment

After receiving the one-time token from [Step 7](#step-7-get-the-one-time-token-ott), create the payment using the [Create payment endpoint](https://docs.y.uno/reference/payments/create-payment.md). Use the `checkout_session` from [Step 3](#step-3-create-the-checkout-session) and the one-time token to create the payment.

The response from the Create payment endpoint will include the parameter `sdk_action_required`, which defines if additional actions are required to finish the payment based on the payment type.

> [!WARNING]
>
> **Continue Payment Method Integration**
>
> Yuno **requires** you integrate the `continuePayment` method of the SDK after the payment is created because certain asynchronous payment methods require additional customer actions to complete. The API will inform you of this scenario via the `sdk_action_required` field of the response, which will be returned as true. The `yuno.continuePayment()` function will display additional screens to customers, where they can carry out the necessary actions to complete the payment without you needing to handle every scenario.

### Step 9: Continue payment

Yuno requires integrating the SDK's `continuePayment` method after the payment is created, as certain asynchronous payment methods require additional customer actions to complete. The response from the [Create payment endpoint](https://docs.y.uno/reference/payments/create-payment.md), from Step 8, will include an `sdk_action_required` field. If it returns `TRUE`, you need to call the `continuePayment()` function to show additional screens that allow the customer to complete the payment. Otherwise, this step is not necessary. Call the `continuePayment` method:

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
continuePayment(
    showPaymentStatus: Boolean = true,
    checkoutSession: String? = null,
    countryCode: String? = null,
    callbackPaymentState: ((String?, String?, StatusMessage?) -> Unit)? = null
)
```

To show your payment status screens, send `FALSE` in the `showPaymentStatus` parameter. Then, get the payment state by callback.

### Direct debit mandates and authorization

For direct debit payment methods (such as ACH, SEPA Direct Debit, Bacs, and PAD) or stored payment methods, the SDK automatically presents the required authorization and mandate text provided by Yuno below the account input fields.

* **Mandate presentation**: Displays the backend-configured debit authorization copy in the customer's language.
* **Mandatory acceptance checkbox**: For payment schemes requiring explicit customer consent before charging or storing the bank account, the SDK renders a required checkbox. The shopper must accept the mandate before the form can be submitted. Consent is packaged and returned with the one-time token.
* **Configuration**: Managed directly via the Checkout Builder's [Authorization text](https://docs.y.uno/docs/using-yuno/dashboard-overview/checkout-builder.md#authorization-text) panel without requiring client-side code changes.

## Common reference

For full parameter and customization details, see the [Android SDK Common Reference](https://docs.y.uno/docs/sdks/resources/references/android.md).


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