Android SDK - OneKYC SDK

interface GoPayEnterpriseSdk {
    // ..
    fun getKycManager(): KycManager
    // ..
}

interface KycManager {
    fun launchKTPScan(activity: Activity, config: EnterpriseKTPScanConfig, helpCenter: EnterpriseHelpCenter)
    fun observeKTPScan(owner: LifecycleOwner, resultCallback: (EnterpriseDocumentVerificationResult) -> Unit)

    fun launchSelfieLiveness(activity: Activity, config: EnterpriseSelfieLivenessConfig, helpCenter: EnterpriseHelpCenter)
    fun observeSelfieLiveness(owner: LifecycleOwner, resultCallback: (EnterpriseDocumentVerificationResult) -> Unit)

    fun launchSelfieVerification(activity: Activity, config: EnterpriseSelfieVerificationConfig, helpCenter: EnterpriseHelpCenter)
    fun observeSelfieVerification(owner: LifecycleOwner, resultCallback: (EnterpriseDocumentVerificationResult) -> Unit)

    fun launchKYCVerification(activity: Activity, config: EnterpriseKYCVerificationConfig, helpCenter: EnterpriseHelpCenter)
    fun observeKYCVerification(owner: LifecycleOwner, resultCallback: (EnterpriseDocumentVerificationResult) -> Unit)
}

KycManager exposes four independent KYC flows. Each flow has a paired launch function (to start the UI) and an observe function (to receive the result asynchronously via a LifecycleOwner-scoped callback).


FlowLaunch functionObserve functionDescription
KTP ScanlaunchKTPScanobserveKTPScanCaptures and OCR-reads a KTP (Indonesian ID card).
Selfie LivenesslaunchSelfieLivenessobserveSelfieLivenessDetects a live selfie to prevent spoofing.
Selfie VerificationlaunchSelfieVerificationobserveSelfieVerificationMatches selfie against a reference document.
KYC VerificationlaunchKYCVerificationobserveKYCVerificationFull KYC verification combining document + selfie.

Configuration Types

All config objects share the same three required fields plus an optional theme.

EnterpriseKTPScanConfig

data class EnterpriseKTPScanConfig(
    val baseUrl: String,
    val token: String,
    val correlationId: String,
    val theme: DigitalIdentityKTPScanFlowTheme = DigitalIdentityKTPScanFlowTheme()
)

EnterpriseSelfieLivenessConfig

data class EnterpriseSelfieLivenessConfig(
    val baseUrl: String,
    val token: String,
    val correlationId: String,
    val theme: DigitalIdentitySelfieLivenessFlowTheme = DigitalIdentitySelfieLivenessFlowTheme()
)

EnterpriseSelfieVerificationConfig

data class EnterpriseSelfieVerificationConfig(
    val baseUrl: String,
    val token: String,
    val correlationId: String,
    val theme: DigitalIdentitySelfieVerificationFlowTheme = DigitalIdentitySelfieVerificationFlowTheme()
)

EnterpriseKYCVerificationConfig

data class EnterpriseKYCVerificationConfig(
    val baseUrl: String,
    val token: String,
    val correlationId: String,
    val theme: DigitalIdentityKYCVerificationFlowTheme = DigitalIdentityKYCVerificationFlowTheme()
)

Shared config fields

FieldTypeRequiredDescription
baseUrlStringYesBase URL of the KYC backend service. Provided by GoPay as part of your integration.
tokenStringYesShort-lived JWT for authenticating the KYC request.
correlationIdStringYesUnique identifier linking the client user to GoPay (obtained from the credential exchange).
theme*FlowThemeNoOptional visual theming for the flow UI. Defaults to the standard GoPay theme.

EnterpriseHelpCenter

Every launch function requires an EnterpriseHelpCenter implementation, which lets the host app control help CTA visibility and handle taps.

interface EnterpriseHelpCenter {
    fun isHelpCTAVisible(helpCenterType: EnterpriseHelpCenterType): Boolean
    fun onHelpCTAClicked(helpCenterType: EnterpriseHelpCenterType): Boolean
}

enum class EnterpriseHelpCenterType {
    SELFIE_TIMEOUT,
    VERIFICATION_EXHAUSTED,
    VERIFICATION_FAILED,
    CAMERA_ISSUE,
    USER_DETAILS,
    USER_CONSENT,
    NON_PROGRESSIVE_USER_CONSENT,
    KYC_STATUS
}
FunctionDescription
isHelpCTAVisibleReturn true to show the help button for the given context. Return false to hide it.
onHelpCTAClickedCalled when the user taps the help button. Return true if you handled the action; false to let the SDK handle it.

Result Types

EnterpriseDocumentVerificationResult

Delivered to the observe* callback after a flow completes, is cancelled, or errors.

data class EnterpriseDocumentVerificationResult(
    val correlationId: String,
    val status: EnterpriseDocumentVerificationResultStatus,
    val submissionId: String,
    val extra: EnterpriseExtraData? = null
)

enum class EnterpriseDocumentVerificationResultStatus {
    COMPLETED, NOT_COMPLETED, ERROR
}
FieldDescription
correlationIdThe correlation ID provided in the config for this flow.
statusCOMPLETED on success, NOT_COMPLETED if cancelled/dropped, ERROR if a failure occurred.
submissionIdBackend submission reference for this attempt. Available when status == COMPLETED.
extraPresent when status == NOT_COMPLETED or ERROR. Carries error code and message details.

EnterpriseExtraData

data class EnterpriseExtraData(
    val errorCode: EnterpriseFlowErrorCode = EnterpriseFlowErrorCode.USER_CANCELLED,
    val detailedErrorCode: String = "",
    val errorMessage: String = ""
)

enum class EnterpriseFlowErrorCode {
    CAMERA, PERMISSION, NETWORK, API, VERIFICATION, HELP_CLICKED, SECURITY, USER_CANCELLED
}
Error CodeDescription
CAMERACamera could not be opened or is unavailable.
PERMISSIONRequired permissions were not granted.
NETWORKA network failure occurred during the flow.
APIThe KYC backend returned an error response.
VERIFICATIONVerification logic failed (e.g. liveness not detected).
HELP_CLICKEDUser tapped the help CTA and the host app returned true from onHelpCTAClicked.
SECURITYA security check failed (e.g. root detection, spoofing detected).
USER_CANCELLEDUser navigated back or dismissed the flow without completing.

Example Usage

// 1. Initialize the SDK
val sdk = GoPayEnterpriseFactory.createEnterpriseSdk(
    context = applicationContext,
    configuration = GoPayEnterpriseConfiguration(
        clientID = "YOUR_CLIENT_ID",
        environment = GoPayEnterpriseEnvironment.STAGING,
        enableDebugLogs = true,
        locale = GoPayEnterpriseLocale.en,
    ),
    callbackDelegate = object : GoPayEnterpriseCallbackDelegate {
        override fun onDismiss() { }
        override fun onFailure(error: GoPayEnterpriseError) { }
    }
)

// 2. Get KYC manager
val kycManager = sdk.getKycManager()

// 3. Register observers (do this once, e.g. in onViewCreated)
kycManager.observeKTPScan(owner = this) { result ->
    when (result.status) {
        EnterpriseDocumentVerificationResultStatus.COMPLETED ->
            Log.d(TAG, "KTP scan complete: ${result.submissionId}")
        EnterpriseDocumentVerificationResultStatus.NOT_COMPLETED ->
            Log.w(TAG, "KTP scan not completed: ${result.extra?.errorCode}")
        EnterpriseDocumentVerificationResultStatus.ERROR ->
            Log.e(TAG, "KTP scan error: ${result.extra?.errorMessage}")
    }
}

kycManager.observeSelfieLiveness(owner = this) { result -> /* handle */ }
kycManager.observeSelfieVerification(owner = this) { result -> /* handle */ }
kycManager.observeKYCVerification(owner = this) { result -> /* handle */ }

// 4. Define a help center implementation
val helpCenter = object : EnterpriseHelpCenter {
    override fun isHelpCTAVisible(helpCenterType: EnterpriseHelpCenterType): Boolean = true
    override fun onHelpCTAClicked(helpCenterType: EnterpriseHelpCenterType): Boolean {
        // Open your help screen or show a dialog
        return true
    }
}

// 5. Launch a flow
kycManager.launchKTPScan(
    activity = this,
    config = EnterpriseKTPScanConfig(
        baseUrl = "https://kyc.example.com",
        token = "user-jwt-token",
        correlationId = "user-correlation-id"
    ),
    helpCenter = helpCenter
)

// Launch selfie liveness
kycManager.launchSelfieLiveness(
    activity = this,
    config = EnterpriseSelfieLivenessConfig(
        baseUrl = "https://kyc.example.com",
        token = "user-jwt-token",
        correlationId = "user-correlation-id"
    ),
    helpCenter = helpCenter
)

Usage Notes

  • getKycManager() takes no parameters. Obtain it directly from the GoPayEnterpriseSdk instance.
  • Register all observe* callbacks before calling the corresponding launch* function to avoid missing results.
  • observe* callbacks are scoped to the provided LifecycleOwner — they are automatically unregistered when the owner is destroyed.
  • All four config types share the same field set (baseUrl, token, correlationId, theme). The theme field defaults to the standard GoPay theme if not provided.
  • EnterpriseHelpCenter is required on every launch call. If help functionality is not needed, return false from both interface methods.
  • All three config fields (baseUrl, token, correlationId) must be non-empty. Passing blank values may result in a runtime error from the KYC service.
  • correlationId is typically the userCorrelationId obtained from ExchangeResult.Success during the verify flow.