Lite SDK (Enrollment)
Step 1: Include the library in your project.
First, 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}'
}
Yuno SDK includes by default INTERNET permission, once it is required to make network requests.
<uses-permission android:name="android.permission.INTERNET"/>
Step 2: Initialize SDK with the public key
2.1. To initialize the Yuno SDK, first, you need to get your public API keys from the Yuno dashboard. Then, if you have not implemented a custom application yet, you will need to create one and call the initialize function in the method onCreate()
of your application class.
The following code snippet includes an example of a custom application:
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.
)
}
}
2.2. Please use the data class YunoConfig
as presented below:
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.
)
2.3. In addition, you need to update your manifest to use your application:
<application
android:name=".CustomApplication">
</application>
Step 3: Enroll a new payment method
Call the following method from your activity to start an enrollment flow of a new payment method.
startEnrollment(
requestCode: Int, //Optional
customerSession: String,
countryCode: String,
showEnrollmentStatus: Boolean, //Optional - Default true
callbackEnrollmentState: ((String?) -> Unit)?, //Optional - 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
andSTEP_BY_STEP
.
- SDK Customizations: Change the SDK appearance to match your brand.
Updated 3 months ago