using ComplyCube.Net;
using ComplyCube.Net.Resources.Clients;
var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var newClient = new ClientRequest {
type = "person",
email = "john.doe@example.com",
personDetails = new PersonDetails {
firstName = "John",
lastName = "Doe"
}
}
var client = await clientApi.CreateAsync(newClient);
Example response
The response will contain an id (the Client ID), which is required for the next step.
use ComplyCube\ComplyCubeClient;
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$token = $ccapi->tokens()->generate('CLIENT_ID', 'com.complycube.SampleApp');
using ComplyCube.Net;
using ComplyCube.Net.Resources.SDKTokens;
var sdkTokenApi = new SDKTokenApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var sdkTokenRequest = {
clientId = "CLIENT_ID",
appId = "com.complycube.SampleApp"
}
var sdkToken = await sdkTokenApi.GenerateToken(sdkTokenRequest);
Example response
{
"token": "<CLIENT_TOKEN>"
}
4. Prepare the stages
Set up the stages you wish to include in your flow.
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.
let sdk = ComplyCubeMobileSDK.FlowBuilder()
.withSDKToken("SDK_TOKEN")
.withClientId("CLIENT_ID")
.withStages([documentStage, selfieStage])
.start(fromVc: self)
var clientAuth = ClientAuth("SDK_TOKEN", "CLIENT_ID")
use ComplyCube\ComplyCubeClient;
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$result = $ccapi->checks()->create('CLIENT_ID', [
'type' => 'document_check',
'documentId' => 'DOCUMENT_ID'
]);
using ComplyCube.Net;
using ComplyCube.Net.Resources.Checks;
var checkApi = new CheckApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var checkRequest = new CheckRequest {
clientId = "CLIENT_ID",
type = "document_check",
documentId = "DOCUMENT_ID"
};
var check = await checkApi.CreateAsync(checkRequest);
7. Retrieve results
Example request
curl -X GET https://api.complycube.com/v1/checks/{:checkId} \
-H 'Authorization: <YOUR_API_KEY>'
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
check = cc_api.checks.get('CHECK_ID')
use ComplyCube\ComplyCubeClient;
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$check = $ccapi->checks()->get('CHECK_ID');
using ComplyCube.Net;
using ComplyCube.Net.Resources.Checks;
var checkApi = new CheckApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var check = await checkApi.GetAsync("CHECK_ID");
Stages
Each stage in the flow can be customized to create the ideal journey for your clients.
The snippet below demonstrates how to set up a customized flow using the ComplyCube Mobile SDK.
// 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.
Creating a custom appearance
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.
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 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
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
}
Get started with our for an overview of our core platform and its multiple features, or browse the for fine-grained documentation of all our services.
Complete the steps in the and tabs.
Sentry Integration
Complete the steps 1 and 2 in the tabs.
Complete Application permissions steps in the tabs.
Complete the steps in the tab.
Complete the steps in the and tabs.
Before launching the SDK, your app must first using the ComplyCube API.
A client represents the individual you need to perform identity verification checks on. This must be done on your server, not the mobile app itself.
SDK Tokens enable clients to send personal data securely from your mobile app to ComplyCube. .
result.documentId to run a .
result.documentId and result.livePhotoId to run an .
StageResult.Document.Id to run a .
StageResult.Document.Id and StageResult.LivePhoto.Id to run an .
result.documentId to run a .
result.documentId and result.livePhotoId to run an .
result.documentId to run a .
result.documentId and result.livePhotoId to run an .
result.documentId to run a .
result.documentId and result.livePhotoId to run an .
Your can retrieve all check results using our API.
All our checks are asynchronous. If you have as described in our , you will be notified once a check completes.
To retrieve the check results, you can perform a get .
Learn more about our .
Upon an "on success" callback, you can initiate directly from your server. This can be done using the IDs of the uploaded resources, returned in the result parameter.
If the SDK experiences any issues, the "onerror" callback will return a ComplyCubeError. Learn more about our .
The SDK tracks an array of 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 .