Skip to main content
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.

Additional resources

Requirements

  • Minimum SDK Version: minSdkVersion 21 or above
  • 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)
  • Active Yuno account
  • API credentials (obtain from the Yuno DashboardDevelopers > Credentials)
  • Create a customer using the Create customer endpoint before enrolling

Parameters

For the full list of parameters, see the Android SDK Common Reference.
ParameterDescription
customerSessionCustomer session ID from Create customer session API. Required.
countryCodeISO country code. Required.
showEnrollmentStatusShow enrollment result screen. Optional; default true.
callbackEnrollmentStateCallback: enrollment state. Optional; requires initEnrollment in onCreate.
requestCodeOptional; use if capturing result via onActivityResult.
countryCodeCountry for the enrollment. Required for apiClientEnroll.
customerSessionCustomer session ID. Required for apiClientEnroll.

full-checkout Enrollment (Android)

Yuno full-checkout for Android provides enrollment with pre-built UI, card enrollment, status handling, and basic error management. See Requirements above.

Step 1: Create a customer

Create a customer in Yuno’s system using the Create customer endpoint before enrolling payment methods. This endpoint returns a customer_id. Then create a customer session using the Create Customer Session endpoint; use the returned customer_session when calling the enrollment methods.

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:
maven { url "https://yunopayments.jfrog.io/artifactory/snapshots-libs-release" }
Add the dependency in build.gradle:
dependencies {
    implementation 'com.yuno.payments:android-sdk:2.11.0'
}

Permissions

The Yuno SDK includes the INTERNET permission by default, which is required to make network requests.
<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
  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:
class CustomApplication : Application() {
  override fun onCreate() {
    super.onCreate()
    Yuno.initialize(
      this,
      PUBLIC_API_KEY,
      config = YunoConfig(),
    )
  }
}
Use the data class YunoConfig to customize the SDK’s behavior. Include this configuration when calling Yuno.initialize(). The available options are:
data class YunoConfig(
    val saveCardEnabled: Boolean = false,
    val keepLoader: Boolean = false,
    val language: YunoLanguage? = null,
    val styles: YunoStyles? = null
)
cardFlow removed from YunoConfigStarting 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.
fun ComponentActivity.initEnrollment(
    callbackEnrollmentState: ((String?) -> 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.
fun Activity.startEnrollment(
    customerSession: String,
    countryCode: String,
    showEnrollmentStatus: Boolean = true,
    callbackEnrollmentState: ((String?) -> Unit)? = null,
    requestCode: Int
)
startEnrollment parameters:
ParameterDescription
customerSessionThe session customer associated with the current enrollment process.
countryCodeCountry code where the payment is performed. See Country coverage for a complete list of supported countries and their codes.
showEnrollmentStatusIndicates whether the enrollment status should be shown. This parameter is optional and defaults to true.
callbackEnrollmentStateA function that returns the current state of the enrollment process. This parameter is optional and defaults to null. To register this callback, you must call initEnrollment method in the onCreate method of the activity. Check the possible states that can be returned.
requestCodeIt is an optional parameter you must inform if you are going to use the onActivityResult method to capture the enrollment states.

Common reference

For full parameter and customization details, see the Android SDK Common Reference.