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

> Enroll payment methods on Android using full-checkout with pre-built UI and ProGuard configuration

> [!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 implement enrollment flows for saving payment methods to a customer account.

Include the library in your project by following the same steps as in [full-checkout](https://docs.y.uno/docs/sdks/full-checkout/android-payments#include-the-library-in-your-project).

## Additional resources

* See [Choose the right integration for you](https://docs.y.uno/docs/sdks/overview/choose-integration.md) if you're unsure which flow to follow.

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

* [full-checkout Enrollment (Android)](#full-checkout-enrollment-android): Automatic enrollment with pre-built UI components

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

## Parameters

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

| Parameter | Description |
| - | - |
| `customerSession` | Customer session ID from Create customer session API. Required for `apiClientEnroll`. |
| `countryCode` | ISO country code. Required for `apiClientEnroll`. |
| `showEnrollmentStatus` | Show enrollment result screen. Optional; default true. |
| `callbackEnrollmentState` | Callback `(state, message)`: enrollment state and, on `INTERNAL_ERROR`, a [`StatusMessage?`](https://docs.y.uno/docs/sdks/resources/references/android#statusmessage-error-details). Optional; requires `initEnrollment` in onCreate. Second parameter added in SDK `2.22.0`. |
| `keepLoader` | If `true`, the SDK loader persists during enrollment, preventing UI flickering. |

## full-checkout Enrollment (Android)

Yuno full-checkout for Android provides enrollment with pre-built UI, card enrollment, status handling, and basic error management. See the preceding [Requirements](#requirements) section.

### Step 1: Create a customer

Create a customer in Yuno's system using the [Create customer endpoint](https://docs.y.uno/reference/customers/create-customer.md) before enrolling payment methods. This endpoint returns a `customer_id`. Then create a customer session using the [Create Customer Session](https://docs.y.uno/reference/customer-sessions-enrollment/create-customer-session.md) endpoint; use the returned `customer_session` when calling the enrollment methods.

On your server, also create an [enrollment payment method object](https://docs.y.uno/reference/payment-methods-checkout/enroll-payment-method-checkout.md) for that customer session to define which payment method the customer can enroll. Keep your private API keys on the server.

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

Add the Yuno library to your Android project:

#### Add the Repository

Add Yuno's Maven repository to your project's Gradle configuration:

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

Add the dependency in `build.gradle`:

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

#### Permissions

The Yuno SDK includes the `INTERNET` permission by default, which is required to make network requests.

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

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

Initialize the SDK:

1. Get your Public API Key from the [Yuno Dashboard](https://dashboard.y.uno/)
2. Create a custom application class if you haven't already done so
3. In the `onCreate()` method of your application class, call `Yuno.initialize()` with your API key:

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

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

> [!NOTE]
>
> For a detailed explanation of the `keepLoader` parameter and mandatory error handling, see the [Android Reference Guide](https://docs.y.uno/docs/sdks/resources/references/android.md#keeploader-parameter).

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

### Step 4: Enroll a new payment method

The enrollment process is a two-step flow. First, initialize the process to set up the necessary components. Then, start the UI flow to allow the user to enroll a payment method.

#### 4.1 Initialize the enrollment process

Call the `initEnrollment` method within your activity's `onCreate` method to prepare your app to handle the enrollment flow. This is a mandatory setup step required by the Android operating system to register the contract that allows the SDK to send the final enrollment status back to your app.

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
fun ComponentActivity.initEnrollment(
    callbackEnrollmentState: ((String?, StatusMessage?) -> Unit)? = null
)
```

#### 4.2 Start the enrollment flow

Call the `startEnrollment` method to launch the user interface and begin the enrollment of a new payment method. You can call this method at any point after `initEnrollment` has been executed, such as when a user taps an "Enroll New Payment Method" button.

```kotlin theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
fun Context.startEnrollment(
    customerSession: String,
    countryCode: String,
    showEnrollmentStatus: Boolean = true,
    callbackEnrollmentState: ((String?, StatusMessage?) -> Unit)? = null
)
```

`startEnrollment` parameters:

| Parameter | Description |
| - | - |
| `customerSession` | The session customer associated with the current enrollment process. |
| `countryCode` | Country code where the payment is performed. See [Country coverage](https://docs.y.uno/docs/sdks/resources/country-coverage.md) for a complete list of supported countries and their codes. |
| `showEnrollmentStatus` | Indicates whether the enrollment status should be shown. This parameter is optional and defaults to `true`. |
| `callbackEnrollmentState` | A function `(state, message)` that returns the current state of the enrollment process and, on `INTERNAL_ERROR`, a [`StatusMessage?`](https://docs.y.uno/docs/sdks/resources/references/android#statusmessage-error-details) describing the failure (declined enrollments carry no message). Optional, defaults to `null`. To register this callback, you must call `initEnrollment` in the `onCreate` method of the activity. Check the possible states that can be returned. |

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