We natively support iOS, Android, React Native, Flutter, and Cordova. You will find the sample apps for our native SDKs below:
Requirements
Swift 5.
iOS 13 and above.
Xcode 13 and above.
Android 5.0 (API level 21) and above.
AndroidX.
Kotlin 1.7 and above.
React Native 0.71 and above.
Please review the iOS and Android requirements.
Flutter 3.3.0 and above.
Dart 3.1.3 and above.
Please review the iOS and Android requirements.
Please review the iOS and Android requirements.
Getting started
Get started with our user guide for an overview of our core platform and its multiple features, or browse the API reference for fine-grained documentation of all our services.
1. Install the SDK
CocoaPods
Before using the ComplyCube SDK, install the CocoaPods plugin by running the following command in your terminal:
sudogeminstallcocoapods
Add plugin repos and install the pod using your Podfile:
Before launching the SDK, your app must first create a client using the ComplyCube API.
A client represents the individual you need to perform identity verification checks on. This must be done on your mobile app backend server, not the mobile app itself.
final stages = [ {"name":'intro',"heading":'Green Bank ID verification', }, {"name":'documentCapture',"showGuidance":false,"useMLAssistance":true,"retryLimit":1,"documentTypes": {"passport":true,"driving_license": ['GB', 'FR'], }, },'faceCapture',];
You can now initialize a flow by setting the SDK Token, Client ID, and the flow stages. The sequence of stages you specify determines the order in which your client sees those stages.
// Java
complycubeFlow.withStages(
new Welcome(...),
new UserConsent(...),
new Document(...),
new SelfiePhoto(...),
new AddressCapture(...),
new ProofOfAddress(...),
new Complete(...)
);
complycubeFlow.withLookAndFeel(...);
complycubeFlow.withCustomLanguage(..);
The SDK allows you to set colors to match your existing application or brand. You can customize the colors by setting the relevant values when building your flow.
Before initiating the flow, create your own custom design and integrate it into your Flow Builder.
let ccLookAndFeel = LookAndFeel()
ccLookAndFeel.primaryButtonBgColor = .green
ccLookAndFeel.uiInterfaceStyle = .dark //can also be .light or .inherited
Applying your custom appearance
Set the custom appearance that you have created using the Flow Builder.
let sdk = ComplyCubeMobileSDK.FlowBuilder()
.withLookAndFeel(ccLookAndFeel)
.start(fromVc: self)
// Kotlin
complycubeFlow.withLookAndFeel(
lookAndFeel = LookAndFeel(
primaryButtonBgColor = Color.RED,
/* Can also be set to UIInterfaceStyle.LIGHT
or UIInterfaceStyle.INHERITED */
uiInterfaceStyle = UIInterfaceStyle.DARK
)
)
const settings = {
// ...
lookAndFeel: {
// Primary action button background color
primaryButtonBgColor: "#FFFFFF",
// Force SDK to 'dark', 'light', or 'inherit' mode
uiInterfaceStyle: "dark",
},
};
Appearance properties
Appearance Property
Description
primaryButtonBgColor
Primary action button background color.
primaryButtonPressedBgColor
Primary action button pressed background color.
primaryButtonTextColor
Primary action button text color.
primaryButtonBorderColor
Primary action button border color.
secondaryButtonBgColor
Secondary button background color.
secondaryButtonPressedBgColor
Secondary action button pressed background color.
secondaryButtonTextColor
Secondary action button text color.
secondaryButtonBorderColor
Secondary action button border color.
documentTypeSelectorBgColor
Document type selection button color.
documentTypeSelectorBorderColor
Document type selection button border color.
documentTypeSelectorTiteTextColor
Document type selection title text color.
documentTypeSelectorDescriptionTextColor
Document type selection description text color.
documentTypeSelectorIconColor
Document type selection icon color.
bodyTextColor
Screen body text color.
linkButtonTextColor
Links color.
headingTextColor
Title heading text color.
subheadingTextColor
Subheading text color.
infoPanelTitleColor
Information panel title color.
infoPanelDescriptionTextColor
Information panel description text color.
infoPanelBgColor
Information panel background color.
infoPanelIconColor
Information panel icon color.
errorPanelTitleColor
Error panel title color.
errorPanelDescriptionTextColor
Error panel description text color.
errorPanelBgColor
Error panel background color.
errorPanelIconColor
Error panel icon color.
cameraButtonBgColor
Camera capture button background color.
uiInterfaceStyle
Set the SDK to use dark mode, light mode, or system Inherited.
Localization
The SDK provides the following international language support:
Arabic - ar 🇦🇪
Chinese (Simplified) - zh 🇨🇳
Chinese (Traditional) - hk 🇨🇳
Dutch - nl 🇳🇱
English - en 🇺🇸
French - fr 🇫🇷
German - de 🇩🇪
Hindi - hi 🇮🇳
Indonesian - id 🇮🇩
Italian - it 🇮🇹
Japanese - ja 🇯🇵
Korean - ko 🇰🇷
Norwegian - no 🇳🇴
Polish - po 🇵🇱
Portuguese - pt 🇵🇹
Spanish - es 🇪🇸
Swedish - sv 🇸🇪
Thai - th 🇹🇭
Vietnamese - vi 🇻🇳
Result handling
To handle results you must implement the success, cancelled or error callbacks.
Upon an "on success" callback, you can initiate check requests directly from your mobile app backend server. This can be done using the IDs of the uploaded resources, returned in the result parameter.
extension ViewController: ComplyCubeMobileSDKDelegate {
func onSuccess(_ result: ComplyCubeResult) {
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'result' parameter will contain `documentIds`and `livePhotoId`
*/
print("The flow has completed - here are the ID's returned")
}
func onError(_ error: ComplyCubeError) {
// Handle errors
print("An error has occurred")
}
func onCancelled(_ error: ComplyCubeError) {
// Handle cancellations
print("The user has cancelled the flow or not accepted the terms")
}
}
//Kotlin
//Register a result handler to process the outcome of the flow.
var complycubeFlow =
ComplyCubeSdk.Builder(
this,
callback = { result ->
when (result) {
is Result.Success -> {
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'Result' will contain an array of stage results.
Each stage result provides the ID of the uploaded item:
- 'StageResult.Document.Id': the uploaded Document ID.
- 'StageResult.LivePhoto.Id': the uploaded Live Photo ID.
- 'StageResult.ProofOfAddress.Id': the uploaded PA Document ID.
*/
}
is Result.Cancelled -> { /* Handle Cancelled result */ }
is Result.Error -> {
// Handle errors
when (result.errorCode) {
ComplyCubeErrorCode.UploadError -> {
// Handle Upload error
}
ComplyCubeErrorCode.BiometricStageCount -> {
// Handle BiometricStageCount error
}
// ...other error handlers
}
}
else -> {}
}
}
)
complycubeFlow.start(clientAuth)
// Java
//Register a result handler to process the outcome of the flow.
ComplyCubeSdk.Builder complycubeFlow = new ComplyCubeSdk.Builder(this, result - > {
if (result instanceof Result.Success) {
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'Result' will contain an array of stage results.
Each stage result provides the ID of the uploaded item:
- 'StageResult.Document.Id': the uploaded Document ID.
- 'StageResult.LivePhoto.Id': the uploaded Live Photo ID.
- 'StageResult.ProofOfAddress.Id': the uploaded PA Document ID.
*/
} else if (result instanceof Result.Error) {
switch (((Result.Error) result).getErrorCode()) {
case ComplyCubeErrorCode.UploadError.INSTANCE:
// Handle upload error
break;
case ComplyCubeErrorCode.BiometricStageCount.INSTANCE:
// Handle BiometricStageCountError
break;
// ... other error handlers
default:
}
} else if (result instanceof Result.Canceled) {
// Handle Cancelled result
}
return null;
});
function onSuccess(results){
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'results' parameter will contain:
- "documentIds": ["xxxxx"]
- "livePhotoIds": ["xxxxx"]
- "poaIds": ["xxxxxx"]
*/
console.log(results);
}
function onCancelled(){
console.log("The user cancelled");
}
function onError(error){
console.log(error);
}
return(<View>
<ComplyCube
settings={settings}
onSuccess={onSuccess}
onCancel={onCancelled}
onError={onError}
/>
</View>
)
void onSuccess(Map<String, dynamic> results) {
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'results' parameter will contain:
- "documentIds": ["xxxxx"]
- "livePhotoIds": ["xxxxx"]
- "poaIds": ["xxxxxx"]
*/
}
void onCancelled() {
// Handle cancellations
}
void onError(ComplyCubeError error) {
// Handle errors
}
ComplyCubeWidget(
settings: settings,
onSuccess: onSuccess,
onCancelled: onCancelled,
onError: onError,
)
function onSuccess(results){
/*
Handling successful results:
Our default flow includes three components: an Identity Document,
a Selfie (Live Photo), and a Proof of Address. Upon successful
completion, the 'results' parameter will contain:
- "documentIds": ["xxxxx"]
- "livePhotoIds": ["xxxxx"]
- "poaIds": ["xxxxxx"]
*/
console.log(results);
}
function onCancelled(){
console.log("The user cancelled");
}
function onError(error){
console.log(error);
}
complycube.start(
settings,
(results) => console.log("Success"),
(cancel_event) => console.log("Cancel event fired"),
(error_event) => console.log("Error event fired"),
(custom_event) => console.log("Custom event fired"),
(token_event) => console.log("Token expiry event fired")
);
If the SDK experiences any issues, the "onerror" callback will return a ComplyCubeError. Learn more about our Mobile SDK error codes.
If the client exits the SDK flow before completion, the description provided by the "on cancelled" callback will specify the reason.
It's possible that the client advanced as far as the upload stage before choosing to cancel. In such cases, some data may already have been uploaded to their record.
Events tracking
The SDK tracks an array of events across the various stages of a flow.
If you want to implement your own user tracking, the SDK enables you to insert your custom tracking code for the tracked events.
To incorporate your own tracking, define a function and apply it using withEventHandler when initializing the FlowBuilder:
let sdk = ComplyCubeMobileSDK.FlowBuilder()
.withEventHandler({ (event: Event) -> Void in
// Insert custom user tracking code here
})
To incorporate your own tracking, define a function and apply it using withEventHandler when initializing the Builder:
// Kotlin
complycubeBuilder.withEventHandler(true) { event ->
// Insert custom user tracking here
}
// Java
complycubeFlow.withEventHandler(true, analyticsEvent - >
// Insert custom user tracking here
);
To incorporate your own tracking, define a function and apply it using the eventHandler property in your settings:
function myCustomEventHandler(event){
// Insert custom user tracking code here
console.log(event.code);
console.log(event.message);
}
const settings = {
eventHandler: {myCustomEventHandler}
// ... other settings
}
To incorporate your own tracking, define a function and apply it using the onCustomEvent property when initializing the Flutter widget:
void onCustomEvent(ComplyCubeCustomEvent event){
switch(event.name){
case 'BIOMETRICS_STAGE_SELFIE_CAMERA':
print("The client reached capture camera for a selfie")
break;
}
}
ComplyCubeWidget(
settings: settings,
onCustomEvent: onCustomEvent,
// ...
),
To incorporate your own tracking, define a function and apply it using the eventHandler property in your settings:
If you want to automatically manage token expiration, you can use a callback function to generate a new token and seamlessly continue the process with it.
let sdk = ComplyCubeMobileSDK.FlowBuilder()
.withTokenExpiryHandler({ () -> String in
// Insert custom token renewal code here
})
// Kotlin
var complyCubeBuilder = ComplyCubeSdk.Builder(this,
callback = { result ->
if (result is Result.Error) {
if (result.errorCode is ComplyCubeErrorCode.ExpiredToken) {
// Insert custom token renewal code here
}
}
}
)
// Java
ComplyCubeSdk.Builder complyCubeBuilder =
new ComplyCubeSdk.Builder(this, result - > {
if (result instanceof Result.Error) {
if (((Result.Error) result).getErrorCode() == ComplyCubeErrorCode.ExpiredToken.INSTANCE) {
// Insert custom token renewal code here
}
}
return null;
});
function myCustomExpiryHandler(){
// Insert custom token renewal code here
}
const settings = {
tokenExpiryHandler: {myCustomExpiryHandler}
// ... other settings
}