Integration
This section explains the core integration flow of the VIDA KYC SDK within an Android application. Each step ensures the correct initialization, execution, and cleanup of the SDK lifecycle.
KYC Flow
Follow these steps to integrate KYC into your Android application, from importing the class through releasing resources.
Import VidaKyc
The first step is to import the VidaKyc class into your Activity or Fragment. This class is the entry point for all KYC operations — initialization, starting and stopping the verification process, and releasing resources.
Add this import to any component that will directly interact with the SDK.
import id.vida.kyc.VidaKyc;Create VidaKyc Instance
Use the VidaKycBuilder class to create an instance of the VidaKyc class.
You can specify the detection configurations, UI customization through the builder.
VidaKyc vidaKyc = VidaKyc.VidaKycBuilder
.newInstance(request, listener)
.build();request
VidaKycRequest
Contains the authentication tokens and flow type. See VidaKycRequest.
listener
VidaKycListener
Receives the lifecycle callbacks. See VidaKycListener.
Once built, the VidaKyc instance becomes your central interface for managing KYC operations.
Start KYC Detection
Once the vidaKyc is initialized, you can start the KYC/OCR detection by calling the startFlow() API.
vidaKyc.startFlow();The startFlow() method begins the KYC capture and verification flow, launching the SDK camera interface and guiding users through:
Document scanning (e.g., KTP, Passport, or ID).
Face capture and matching (if required by the selected flow).
It handles frame processing, OCR extraction, liveness checks, and backend verification automatically. When the flow completes successfully, the SDK invokes onSuccess(VidaKycResponse) on the listener.
Stop KYC Detection
vidaKyc.finishFlow();This method allows the host app to manually stop the KYC process before it finishes, typically in cases where:
The user cancels the process.
An external condition (like network loss) requires halting detection.
The SDK gracefully stops all camera operations and releases partial resources.
Release Resources
Releasing resources is essential after completing or canceling the flow. It ensures all camera sessions, background threads, and temporary memory allocations used by the SDK are properly disposed of. Always invoke release() after a completed session to prevent memory leaks or background processing issues.
vidaKyc.release();VidaKycListener Implementation
public interface VidaKycListener {
void onInitialized();
void onSuccess(VidaKycResponse response);
void onError(int errorCode, @NonNull String errorMessage, @Nullable VidaKycResponse response);
}The VidaKycListener interface enables the host application to respond to SDK lifecycle events:
onInitialized()Called when the SDK is successfully initialized and ready to start KYC operations. You should only call startFlow() after this callback.onSuccess(VidaKycResponse response) Triggered upon successful completion of the KYC flow. The VidaKycResponse contains results of all backend and OCR verifications, including scores and metadata.onError(int errorCode, String errorMessage, VidaKycResponse response) Called when an error occurs during initialization or the KYC process. The response object may include diagnostic data if available; otherwise, it may be null.
This listener pattern ensures asynchronous and event-driven control over SDK operations.
VidaKycRequest
The customer needs to create a VidaKycRequest class object and pass it while creating a VidaKyc instance.
VidaKycRequest request = new VidaKycRequest();
request.setVidaFlow(VidaFlow.ID_VERIFICATION);// OR VidaFlow.KYC
request.setToken(token);
vidaKycRequest.setPartnerTransactionID("PARTNER_TRANSACTION_ID");
vidaKycRequest.setVidaSdkRegion(VidaSdkRegion.INDONESIA);
vidaKycRequest.setApiKey("API_KEY");
vidaKycRequest.setLicenseKey("LICENSE_KEY");
vidaKycRequest.setVidaIdFraudShieldClientId("CLIENT_ID");The VidaKycRequest class defines the configuration and authentication parameters for the KYC process.
setVidaFlow (VidaFlow.ID_VERIFICATION)
Required
Defines the type of verification flow (e.g., ID verification, KYC ).
setToken (String token)
Required
The secure token provided by VIDA’s backend for authentication. This token ensures the request is tied to your organization and user session.
setPartnerTransactionID (String)
Optional
Your own reference for this KYC flow. If you do not set it, the SDK creates a UUID for you. The SDK adds the operation name and attempt number to your value, so the partnerTrxId in the SDK response will not be the same as the value you sent. See the SDK Response page.
setVidaSdkRegion()
Required
Set the region of which ID card verification or KYC needs to be performed.
setApiKey()
Required for KYC Optional for ID Verification
API key provided by VIDA. Contact VIDA support to obtain it.
setLicenseKey()
Required for KYC Optional for ID Verification
License key provided by VIDA. Contact VIDA support to obtain it.
setVidaIdFraudShieldClientID
Optional
Enables ID Fraud Shield for the flow. If it is not set, the ID Fraud Shield SDK remains disabled.
Each request instance is used once per KYC flow to ensure a clean and traceable verification session.
VidaKycResponse (id.vida.kyc.dtos)
public final class VidaKycResponse {
public VidaVerifyResponseDTO getVidaCardVerificationDetails() {...}
public VidaVerifyResponseDTO getVidaFaceMatchDetails() {...}
}public enum VIDAKycOperation {
FRONT_CARD_ID_VERIFICATION,
BACK_CARD_ID_VERIFICATION,
LIVENESS_VERIFICATION,
FACE_VERIFICATION
}The VidaKycResponse class encapsulates the results of the entire KYC verification process. It contains details of both document and face verification stages.
Accessor Methods
getVidaCardVerificationDetails()
VidaVerifyResponseDTO
Document verification results, including OCR extraction data and any backend validation errors.
getVidaFaceMatchDetails()
VidaVerifyResponseDTO
Face matching results, including confidence scores, detected errors, and liveness evaluation outcomes.
getVidaLivenessResponse()
VidaLivenessResponseInternal
Liveness results, including liveness score, manipulation score, detected errors, and related details.
getVidaFailedOperation()
VIDAKycOperation
The last failed operation. See below.
Builder Inner Class The builder pattern ensures the response object is immutable and constructed only through controlled SDK operations.
The response serves as the final structured output from the VIDA SDK, passed via the onSuccess() or onError() callbacks in VidaKycListener.
Last updated
