Skip to main content
Orientation: Choosing Your Integration Flow, before you begin, please review the Official Integration Flow.
  • Standard Flow (Full Checkout): 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.
This page provides a guide to the Yuno Headless SDK for Android enrollment. The Yuno Headless SDK for Android provides a flexible, UI-free solution for enrolling payment methods and tokenizing cards. This SDK offers complete control over the payment method enrollment process, making it ideal for merchants who:
  • Need full control over the UI and user experience
  • Want to implement custom enrollment flows
  • Require advanced integration capabilities
The Headless SDK includes core features like:
  • Card tokenization
  • Secure payment method enrollment
  • Direct API access
  • Custom error handling
For merchants requiring a pre-built UI solution or simpler integration, consider using our other SDK implementations:

Requirements

Before starting the Yuno Android SDK integration, ensure your project meets the technical 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)

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.

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.
SDK Version InformationVerify the current SDK version by accessing the Release notes or visiting the Yuno Android SDK repository.

Step 1: Create a customer

Create a customer using the Create Customer endpoint before enrolling payment methods.

Step 2: Create a customer session

Create a new customer_session using the Create Customer Session endpoint:
  • Include the customer ID in the request
  • Store the returned customer_session ID
  • Generate a new customer_session for each payment method enrollment.

Step 3: Add the SDK to your project

  1. Add the repository source:
  1. Add the SDK dependency:
Internet Permission RequiredThe Yuno SDK automatically includes the INTERNET permission, necessary for network requests. Ensure your AndroidManifest.xml contains:<uses-permission android:name="android.permission.INTERNET" />

Step 4: Initialize Headless SDK with the public key

Retrieve your public API keys from the Yuno dashboard. If you haven’t implemented a custom application, create one. In the onCreate() method of your application class, call the initialize function (Yuno.initialize):

Step 5: Create an enrollment payment method object

Create an enrollment payment method object using the Enroll Payment Method endpoint to set up the Headless SDK integration for enrollment. When creating this object, specify which payment method type your customer can enroll in. Currently, the Headless SDK only supports the CARD payment method type.
Card VerificationTo verify cards (zero value authorization) before enrollment, include the verify object when creating the payment method object for the customer session.

Step 6: Start the enrollment process

Use the apiClientEnroll function to start the enrollment process. This function requires configuration parameters that define how the enrollment will be processed. The following table describes the required parameters: The following code block shows an example of the parameter configuration:

Step 7: Generate a vaulted token

After collecting all required customer information, create a vaulted_token using the apiClientEnroll.continueEnrollment function. Since this is an asynchronous function, use a try/catch block to handle any errors that may occur. The following example shows how to create a vaulted_token:
The apiClientEnroll.continueEnrollment function returns an Observable type that extends LiveData. You can observe the response as a standard LiveData with type SingleLiveEvent<Map<String, Any?>>. This LiveData emits only once and returns a Map containing the complete response. Below is an example response from calling apiClientEnroll.continueEnrollment:
The following code block shows an example of observing the response:

Enrollment flow states

The apiClientEnroll.continueEnrollment function returns a response that includes a status field indicating the current state of the enrollment process. The following are the possible states returned:
The following table provides additional information about the possible states:
Webhook Status TrackingConsider using the enrollment status received via Webhooks. Yuno recommends always using this status to base and make business decisions on your platform.

Error handling

Handle errors returned by the SDK in your app (e.g. failed payments, validation errors). For HTTP status and response codes, see Status and response codes in the API reference.