Lite SDK (Enrollment Android)
Orientation: Choosing Your Integration Flow, before you begin, please review the Official Integration Flow.
- Standard Flow (Full Checkout): Recommended for most merchants. WHITELABEL 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.
Follow this step-by-step guide to implement and enable WHITELABEL’s Lite Android SDK enrollment capability in your app.
Step 1: Include the library in your project
Before proceeding with the Lite SDK implementation, see the Quickstart Guide for detailed instructions on how to properly integrate the SDK into your project.
Choose the integration method that best suits your development workflow and technical requirements. After completing the SDK integration, you can proceed with the following steps to implement the lite enrollment functionality.
Step 2: Initialize SDK
Initialize the WHITELABEL SDK in your Application class by providing a valid PUBLIC_API_KEY:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Yuno.initialize(
this,
publicApiKey = "YOUR_PUBLIC_API_KEY",
config = YunoConfig()
)
}
}Credentials
See the credentials page for more information: /reference/getting-started/authentication
Step 3: Create a customer session
To start the enrollment process, you need to provide the customer_session. First, you need to create a customer. Use the Create Customer endpoint to create new customers. In the response, you will receive the customer id, which you use to create the customer session.
After creating the customer, you can create the customer session. Use the customer id and the Create Customer Session endpoint. The customer_session will be provided in the response. You need a new customer_session every time you enroll in a new payment method.
Step 4: Start the enrollment process
To provide a lite enrollment experience, you must first initialize the enrollment process and then launch the UI.
1. Initialize enrollment
Call initEnrollment in your activity’s onCreate method to prepare the SDK for the enrollment flow.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initEnrollment { state, message ->
Log.d("YunoEnrollment", "Enrollment state: $state, error: ${message?.code}")
}
}2. Launch enrollment UI
Call startCheckout with the sessions and configuration parameters to display the enrollment form.
startEnrollment(
customerSession = "CUSTOMER_SESSION",
countryCode = "US",
showEnrollmentStatus = true,
requestCode = 100 // Optional: defaults to 0
)Parameters
Configure the lite enrollment with the following options:
| Parameter | Description |
|---|---|
customerSession | Refers to the current enrollment’s customer session. |
countryCode | This parameter specifies the country code for which the enrollment is being set up. |
showEnrollmentStatus | Controls the visibility of the WHITELABEL loading/spinner page during the enrollment process. Defaults to true. |
requestCode | The request code used for the activity result. Defaults to 0. |
Step 5: Enrollment Status
When the enrollment process completes, the SDK invokes the callback provided in initEnrollment with the state and, on INTERNAL_ERROR, a StatusMessage describing the failure (null on every other state).
Possible status values
SUCCEEDED: The enrollment was successful.FAIL: The enrollment failed.PROCESSING: The enrollment is being processed.REJECT: The enrollment was rejected.CANCELED: The user canceled the enrollment.
Demo App
In addition to the code examples provided, you can access the WHITELABEL Android SDK repository for a complete implementation of WHITELABEL SDKs.
Error handling
Handle errors returned by the SDK in your app, such as failed enrollment or validation errors. For HTTP status and response codes, see Status and response codes in the API reference.
Stay updated
Visit the release notes for the latest SDK updates and version history.