Implementation Guide

Authentication

A unique access token should be created upon each SDK entry. In order to generate an access token, please refer to Valify's Authentication Documentation.

Initialization

Declare the following variables

private lateinit var docKitBuilder: VIDVDocKitConfig.Builder

Initialize your SDK in your activity or fragment as follows

docKitBuilder = VIDVDocKitConfig.Builder()

Configurations

The SDK builder is separated into two components.

Make sure that you fetched the access token successfully before passing it to the Builder object.

Required Configurations

docKitBuilder
    .setBaseUrl("Base Url") // add your actual base url
    .setAccessToken("Access Token") // add the fetched access token here
    .setBundleKey("Bundle Key") // add your actual bundle key
    .setDocumentType(VIDVDocKitDocType.<your chosen doc type>()) //avaliable doc types: passport - egyNID - tunNID

Optional Configurations

.setLanguage("en") // or "ar"
.setCollectUserInfo(true) // enable location permissions if true
.previewCapturedImage(true) // show preview of captured image
.reviewData(true) // show a review screen before finishing
.manualCaptureMode(true) // enable manual capture

// UI Customization
config.setPrimaryColor("#FFA500".toColorInt())
config.setLogo(VIDVLogo.ResourceLogo(R.drawable.logo))
config.setLogo(VIDVLogo.ByteArrayLogo(byteArray))
config.setLogo(VIDVLogo.Empty()) // Hide logo

Configurations Breakdown

1. Sets the base URL used by the SDK to communicate with your backend APIs.

.setBaseUrl("Base Url") 

2. Sets the access token required for authenticating SDK API requests.

.setAccessToken("Access Token") // add the fetched access token here

3. Associates the session with your account using a unique bundle key.

.setBundleKey("Bundle Key") // add your actual bundle key

4. Specifies the type of document to be captured by the SDK.

Available options:

  • passport()

  • egyNID()

  • tunNID()

.setDocumentType(VIDVDocKitDocType.passport())

5. Sets the interface language used throughout the SDK experience.

Supported languages:

  • "en" for English

  • "ar" for Arabic

.setLanguage("en")

6. Enables the collection of user info like location. Requires location permission in manifest.

.setCollectUserInfo(true)

7. Enables image preview after capture so users can confirm or retake it.

.previewCapturedImage(true)

8. Displays a data review screen before submitting the final result.

.reviewData(true)

9. Enables manual capture mode for users instead of automatic capture.

.manualCaptureMode(true)

10. Sets your brand’s primary color in the SDK UI. Use a hex color string.

.setPrimaryColor(Color.parseColor("#FFA500"))

11. Displays your logo in the SDK UI using a drawable resource from your app.

.setLogo(VIDVLogo.ResourceLogo(R.drawable.logo))

12. Displays your logo using a byte array (e.g., from a file or server).

.setLogo(VIDVLogo.ByteArrayLogo(byteArray))

13. Hides Valify's logo entirely from the SDK UI.

.setLogo(VIDVLogo.Empty())

Start SDK

Use the following code snippet to run the SDK

config.start(this, object : VIDVDocKitListener {
    override fun onDocKitResult(result: VIDVDocKitResponse) {
        when (result) {
            is VIDVDocKitResponse.Success -> {
                // Handle success
            }
            is VIDVDocKitResponse.ServiceFailure -> {
                // Handle failure
            }
            is VIDVDocKitResponse.BuilderError -> {
                // Handle builder error
            }
            is VIDVDocKitResponse.Exit -> {
                val step = result.step // screen where user exited
            }
        }
    }
})

Last updated