Lite SDK (Enrollment)

On this page, you find all the steps to to perform an enrollment using the Lite SDK in your Android project.

Step 1: Include the library in your project

Ensure the Yuno SDK file is included in your project through Gradle. Then, add the repository source using the following code line:

maven { url "https://yunopayments.jfrog.io/artifactory/snapshots-libs-release" }

After, include the code below in the file build.gradle to add the Yuno SDK dependency to the application.

dependencies {
    implementation 'com.yuno.payments:android-sdk:{last_version}'
}

Permissions

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

<uses-permission android:name="android.permission.INTERNET" />

Step 2: Initialize SDK with the public key

First, you need to 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) as shown in the example below:

class CustomApplication : Application() {
  override fun onCreate() {
    super.onCreate()
    Yuno.initialize(
      this,
      "your api key",
      config: YunoConfig, // This is a data class to use custom configs in the SDK.
    )
  }
}

Use the data class YunoConfig to customize SDK behavior. Include this configuration in the Yuno.initialize:

data class YunoConfig(
    val cardFlow: CardFormType = CardFormType.ONE_STEP, // This is optional, CardFormType.ONE_STEP by default, this is to choose Payment and Enrollment Card flow.
    val saveCardEnabled: Boolean = false, // This is to choose if show save card checkbox on cards flows.
    val keepLoader: Boolean = false // This is to choose if keep Yuno loading screen until you create and continue with payment, this need an additional step that is shown below.
    val language: YunoLanguage? = null, //This is to choose the language of the SDK, if you send null or don't send it, Yuno SDK will take device language.
    val isDynamicViewEnabled: Boolean = false, //This is to choose if you want to use dynamic view or not, if you send false or don't send it, Yuno SDK will take false.
)

In the next table, you find the descriptions for each customization option available.

Customization optionDescription
cardFlowIt is an optional configuration that defines Payment and Enrollment Card flow. By default, the CardFormType.ONE_STEP option is used.
saveCardEnabledEnables the Save card checkbox on card flows.
keepLoaderKeep Yuno's loading screen until you create and continue with payment. To use this feature you need to use the function startCompletePaymentFlow(), described in the next sections.
languageDefine the language used to present the SDK. If you don't send or provide a null value, Yuno SDK will use the device language. The available options are:
- SPANISH
- ENGLISH
- PORTUGUESE
- INDONESIAN
- MALAYSIAN
isDynamicViewEnabledDefines if you want to use the dynamic view. In the case you don't provide a value, Yuno SDK will use the FALSE option.

To ensure that the Yuno loading screen persists until you create and proceed with the payment, you need to use the startCompletePaymentFlow() function.

You also need to update your manifest to use your application:

<application android:name=".CustomApplication"></application>

Step 3: Enroll a new payment method

To create the enrollment flow, you need to call the initEnrollment method on the onCreate method of your activity. This process is required because Yuno's Lite SDK uses it to register the contract to give you the final enrollment state.

fun ComponentActivity.initEnrollment(
    callbackEnrollmentState: ((String?) -> Unit)? = null, //Default null | To register this callback is a must to call ```initEnrollment``` method on the onCreate method of activity.
)

To start the enrollment of a new payment method, you need to use the startEnrollment method. When you call the startEnrollment method, the enrollment flow of a new payment method will start.

fun Activity.startEnrollment(
    customerSession: String,
  	// The complete list of country codes is available on https://docs.y.uno/docs/country-coverage-yuno-sdk
    countryCode: String,
    showEnrollmentStatus: Boolean = true, //Optional - Default true
    callbackEnrollmentState: ((String?) -> Unit)? = null, // Default null | To register this callback is a must to call ```initEnrollment``` method on the onCreate method of activity.
)

Step 4: Callback enrollment state

To register a callback to get the final enrollment state, it is necessary to call the initEnrollment method on the onCreate method of activity.

Complementary Features

Yuno Android SDK provides additional services and configurations you can use to improve customers' experience. Use the SDK Customizations to change the SDK appearance to match your brand or to configure the loader.

Yuno Android SDK provides additional services and configurations you can use to improve customers' experience:

  • Loader: Control the use of the loader.
  • You also can choose one of the render options for the card form. Below you find screenshots presenting the difference between the cardFormType ONE_STEP and STEP_BY_STEP.
Step by step
One step

Demo App

In addition to the code examples provided, you can access the Yuno repository for a complete implementation of Yuno Android SDKs.