Android

Add the PayMedia eKYC SDK to your Android app and start a journey.

Install

The SDK is published to PayMedia's private Maven repository. Your PayMedia contact gives your team read access; keep the credentials out of source control, for example in `~/.gradle/gradle.properties`.

Kotlin · settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/PayMediaSL/saas-revamp-ekyc-runtime")
            credentials {
                username = providers.gradleProperty("paymediaUser").get()
                password = providers.gradleProperty("paymediaToken").get()
            }
        }
    }
}
Kotlin · app/build.gradle.kts
dependencies {
    implementation("lk.paymedia:ekyc-sdk:1.0.0")
}

The SDK's permissions, screens and code-shrinking rules merge into your app automatically. There is nothing to add to your manifest.

Configure

Configure the SDK once, in your `Application`, so it is ready whenever a journey or a call notification needs it.

Kotlin
class BankApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        PayMediaEKYC.initialize(
            this,
            PayMediaConfig(
                journeyHost = "https://onboarding.bank.example",
                sdkKey = BuildConfig.PAYMEDIA_SDK_KEY,
            ),
        )
    }
}

Start a journey

Pass the work flow's id — the last part of its customer link — and a listener. The SDK checks with your institution, then opens the journey full screen.

Kotlin
val listener = object : PayMediaListener {
    override fun onEvent(event: PayMediaEvent) {
        if (event.type == PayMediaEvent.Type.JOURNEY_SUBMITTED) {
            showConfirmation(event.data["reference"])
        }
    }

    override fun onError(error: PayMediaError) {
        when (error) {
            is PayMediaError.VersionUnsupported -> askToUpdate(error.webJourneyUrl)
            is PayMediaError.Network -> showRetry()
            else -> log(error.code)
        }
    }

    override fun onClosed() {
        returnToHome()
    }
}

PayMediaEKYC.startJourney(this, "3f2c9a1e-0000-4000-8000-000000000000", listener)

Join a video call

A tap on the SDK's call notification opens the call by itself. To open one from your own screen — for example a link your backend received — pass its join link:

Kotlin
PayMediaEKYC.joinVideoCall(this, joinUrl, listener)

Sign-out

When the customer signs out of your app, call `terminate`. It forgets the configuration and push token and removes what the journey stored on the device. Call `initialize` again before the next journey.

Kotlin
PayMediaEKYC.terminate(applicationContext)