Skip to main content

Android SDK (Enhanced Version)

Attention

This documentation is for the Enhanced Version, encompassing expanded capabilities and advancements. We strongly recommend testing this version before using it in a production environment.

Getting Started

Latest Version: SDK Version

Requirements

Device Requirement

  • API level 23 (Android 6.0) or higher
  • Internet connection
  • Camera

Project Requirement

  • AndroidX Support

    • Shufti Pro SDK requires AndroidX 1.0.0 or later. If you haven't switched to AndroidX in your app yet then follow this guide.
  • Enable Java 8

    • Shufti Pro SDK requires Java 8 language features to be enabled in your project. If it is not already enabled, add this to your app/build.gradle file under the android section:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

Resources

Integration

SDK Integration Guide

Tip

It’s always recommended to use the updated version

Step 1: Go to root-level setting.gradle in your project and add the following:

setting.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this line
}
}

OR

Go to project > android > build.gradle file and add the following

build.gradle
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add this line
}
}

Step 2: In build.gradle(Module) enable dataBinding true.

app/build.gradle
android {
//Rest of your code
dataBinding {
enabled = true
}
}

Step 3: In build.gradle(Module) add the following implementation

app/build.gradle
implementation 'com.github.shuftipro:android-onsite-sdk:+'

You can find latest version from here

Basic Usage

Note

Make sure you have obtained authorization credentials before proceeding. You can get client id or secret key and generate access token like this.

Authorization

The following code snippet shows how to use the access token in auth object.

  • Access Token

    Make auth object using access token
JSONObject AuthKeys = new JSONObject();

try{
AuthKeys.put("auth_type","access_token");
AuthKeys.put("access_token","sp-accessToken");
} catch (JSONException e) {
e.printStackTrace();
}

Configuration

The Shufti Pro’s mobile SDKs can be configured on the basis of parameters provided in the config object. The details of parameters can be found here.

JSONObject Config=new JSONObject();

try{
Config.put("base_url", "api.shuftipro.com");
Config.put("consent_age", 16);
} catch (JSONException e) {
e.printStackTrace();
}

Request Object

This object contains the service objects and their settings through which the merchant wants to verify end users. Complete details of service objects and their parameters can be found here.

JSONObject requestObject = new JSONObject();

try{
requestObject.put("reference", "Unique-Reference");
requestObject.put("country", "");
requestObject.put("language", "");
requestObject.put("email", "");
requestObject.put("callback_url", "");
requestObject.put("verification_mode", "image_only");
requestObject.put("show_results", "1");
requestObject.put("allow_retry", "0");
requestObject.put("show_ocr_form", "0");

//Creating Face object
JSONObject faceObject = new JSONObject();
faceObject.put("proof", "");

requestObject.put("face", faceObject);

//Creating Document object
JSONObject documentObject = new JSONObject();

ArrayList<String> doc_supported_types = new ArrayList<String>();
doc_supported_types.add("passport");
doc_supported_types.add("id_card");
doc_supported_types.add("driving_license");
doc_supported_types.add("credit_or_debit_card");

documentObject.put("proof", "");
documentObject.put("additional_proof", "");

JSONObject docNameObject = new JSONObject();
docNameObject.put("first_name", "Johon");
docNameObject.put("middle_name", "Johsan");
docNameObject.put("last_name", "Livone");

documentObject.put("name", docNameObject);
documentObject.put("dob", "1980-11-12");
documentObject.put("document_number", "19901112");
documentObject.put("expiry_date", "1996-11-12");
documentObject.put("issue_date", "1990-11-12");
documentObject.put("backside_proof_required", "1");
documentObject.put("supported_types",new JSONArray(doc_supported_types));

requestObject.put("document", documentObject);


//Creating Document Two Object is exactly same as document object.
// Add document two to request object like
...
requestObject.put("document_two", documentTwoObject);

//Creating Address object
JSONObject addressObject = new JSONObject();

ArrayList<String> address_supported_types = new ArrayList<String>();
address_supported_types.add("id_card");
address_supported_types.add("passport");
address_supported_types.add("bank_statement");

JSONObject addressNameObject = new JSONObject();
addressNameObject.put("first_name", "Johon");
addressNameObject.put("middle_name", "Johsan");
addressNameObject.put("last_name", "Livone");

addressObject.put("name", addressNameObject);
addressObject.put("proof", "");
addressObject.put("full_address", "ST#2, 937-B, los angles.");
addressObject.put("supported_types",new JSONArray(address_supported_types));

requestObject.put("address", addressObject);

//Creating consent object
JSONObject consentObject = new JSONObject();

ArrayList<String> consent_supported_types = new ArrayList<String>();
consent_supported_types.add("handwritten");
consent_supported_types.add("printed");

consentObject.put("proof", "");
consentObject.put("text", "This is my consent. ");
consentObject.put("supported_types",new JSONArray(consent_supported_types));

requestObject.put("consent", consentObject);

} catch (JSONException e) {
e.printStackTrace();
}

Initialisation

Shufti Pro’s mobile SDK can be initialised by using the given method and passing auth, config and request object as the parameters.

Shuftipro shuftipro = Shuftipro.getInstance();
shuftipro.shuftiproVerification(requestObject, AuthKeys, Config, MainActivity.this,
new ShuftiVerifyListener() {
@Override
public void verificationStatus(@NonNull Map<String, ?> responseSet) {

Log.e("Response",responseSet.toString());

}
});

Callbacks

The SDK receive callbacks on termination, whether after the request completion or if the journey is left mid-way. The call backs are received in

 new ShuftiVerifyListener() {
@Override
public void verificationStatus(@NonNull Map<String, ?> responseSet) {
{
Log.e("Response",responseSet.toString());
// Handle callback responses here
}
}

The complete list of callback events can be found here.

Callback Handling

All the callbacks can be handled inside the client’s calling activity. The responses and callback handling can be seen below.

On SDK Completion

if(responseSet.get("event").equals("verification.accepted")){
// Verification accepted callback
}
else if(responseSet.get("event").equals("verification.declined")){
// Verification declined callback
}

On SDK Unauthentication

if(responseSet.get("event").equals("request.unauthorized")){
// Verification unauthorized callback. This event occurs when the auth header or its parameters are invalid.
}

On SDK Error

if(responseSet.get("event").equals("permission.denied")){
// This callback is returned in case the permissions are declined by the end user.
}
else if(responseSet.get("event").equals("request.timeout")){
// This callback is returned in case request took too long and is timed out
}
else if(responseSet.get("event").equals("verification.cancelled")){
// This callback is returned when verification is cancelled midway by the end user
}
else if(responseSet.get("event").equals("request.invalid")){
// This callback is returned if the request parameters are incorrect.
}
else {
// Some error has been occured during the verification process
}

Customisation

ShuftiPro supports a set of customisation options that will influence the appearance of the mobile SDK.

UI Customisation

To customise the color scheme of the entire ShuftiPro mobile SDK, as well as the text and background colors of the widgets, you can utilize the following keys within the config object.

JSONObject Config=new JSONObject();

try{
Config.put("base_url", "api.shuftipro.com");
Config.put("button_text_color", "#XXXXXX");
Config.put("button_primary_color", "#XXXXXX");
Config.put("button_secondary_color", "#XXXXXX");
Config.put("heading_color", "#XXXXXX");
Config.put("sub_heading_color", "#XXXXXX");
Config.put("theme_color", "#XXXXXX");
Config.put("icon_color", "#XXXXXX");
Config.put("background_color", "#XXXXXX");
Config.put("stroke_color", "#XXXXXX");
Config.put("shuftipro_light_icon", false);
} catch (JSONException e) {
e.printStackTrace();
}

Localization

Shufti Pro offers users the capability to customise the SDK text according to their preferred language. Merchants can modify the SDK language by specifying the language code in the country parameter within the main request object, such as "language": "en". List of all languages are mention here

NFC verification

Near Field Communication (NFC) is a set of short-range wireless technologies. NFC allows sharing small payloads of data between an NFC tag and an NFC-supported device. NFC Chips found in modern passports and similar identity documents contain additional encrypted information about the owner. This information is very useful in verifying the originality of a document. NFC technology helps make the verification process simple, quicker and more secure. This also provides the user with contactless and input less verification. ShuftiPro's NFC verification feature detects MRZ from the document to authenticate NFC chips and retrieve data from it, so the authenticity and originality of the provided document could be verified.

Initialisation

Once the main SDK is integrated successfully, NFC SDK can be integrated easily by adding an additional dependency in app level build.gradle.

app/build.gradle
dependencies {
implementation 'com.github.shuftipro:nfc-onsite:1.0.5'
}

To check NFC supported documents and countries, please click here.

info

Nfc verification is allowed only on e-passports under document, document_two and address service only.

All-In-One SDK

A dynamic and efficient tool designed to transform user verification into a streamlined and effortless process. This powerful SDK enables the integration of multiple verification journeys using just a single line of code, catering to various user events and scenarios Our SDK automatically listens for the Journey you associate with a customer and initiates the verification process immediately.

Client Side

Step 1: Initialize the ShuftiPro SDK To initialize the SDK, create a new instance of ShuftiPro and call the init method with initial data:

val shuftiPro = Shuftipro.getInstance()
shuftiPro.register(clientId,customerID,configObject(),applicationContext,object : ShuftiVerifyListener {
override fun verificationStatus(responseSet: Map<String, Any>) {
Log.d("RequestResponse", responseSet.toString())
}
})

The details of parameters can be found here.

Step 2 (Optional): Destroying the SDK Instance:

To clean up and destroy the SDK instance, call the destroy method.

shuftiPro.unRegister()

Server Side

Trigger verification Journey

This API triggers verification for a given customer (customer_id) with the provided verification journey (journey_id).

API Endpoint: https://api.shuftipro.com/create/customer/journey

Send the following payload to initiate the creation of a customer journey.

{
"journey_id" : "ULMTCqye1719840116",
"customer_id" : "TestingCustomer595"
"reference" : "123456789"
}

The details of parameters can be found here.

You will receive the following response from the API call.

{
"error": false,
"message": "customer journey created successfully"
}

The details of parameters can be found here.

SDK size

The complete size of Shufti Pro's android SDK is 5.5 MB.

Revision History

DateSDK VersionsDescription
Jul 19, 20241.3.1Improvement
We are implementing the following features in the mobile SDK:
1. All in One SDK.
2. Added new service "AML for business".
3. Masking of Credit & Debit Card number in OCR form.
4. Show images on Retry Screen
5. Reduce the loaders to improve the verification journey.
Jul 12, 20241.3.0Resolution
Introduce a "disable_storage_permission" key in the config object to conditionally remove storage permissions from the SDK.
Jul 08, 20241.2.9Resolution
Fetch country code list from an API to ensure data is always up-to-date, replacing static local lists.
Jul 04, 20241.2.8Resolution
Optimize API logic by centralizing error handling, adding retries, and using async calls.
Jul 02, 20241.2.7Improvement
We are implementing the following features in the mobile SDK:
1. Implement Journey Builder
2. Added support of merchant logo at footer.
Jun 12, 20241.2.6Improvement
We are implementing the following features in the mobile SDK:
1. Enhanced instruction screen.
2. Addition of a nationality field in the OCR form.
3. Integration of NFC functionality.
May 20, 20241.2.5Resolution
Resolution of country flag issues during proof uploads.
May 13, 20241.2.4Improvement
Improved OCR form logic and enhanced data validation.
May 09, 20241.2.3Improvement
Enhanced the post detection of document scanning.
May 03, 20241.2.2Improvement

Improve your theme customisation with the below new parameters.
icon_color: Alter the color of icons within the SDK
background_color: Modify the background color of the SDK.
stroke_color: Adjust the color of borders used within the SDK.
shuftipro_light_icon: Customise the color of the Shuftipro icon in both light and dark modes.
For further details, refer to the customisation section in the documentation.
Apr 24, 20241.2.1Improvement
Enhanced the consent screen and improved the user experience of the SDK.
Apr 23, 20241.2.0Improvement
Incorporated Age parameter support into the document service.
Apr 17, 20241.1.9Improvement
We've implemented a new feature that eliminates the need for OCR inputs for background checks when the name and date of birth are extracted from the document service. This functionality can be activated upon request through ShuftiPro tech support.
Apr 03, 20241.1.8Improvement
Include a layout feature on the camera screen for both face and document services during video recording to enhance the presentation of evidence and improve the user experience.
Mar 27, 20241.1.7Improvement
Implemented a new feature for face liveness verification, requiring users to align their faces with multiple overlays to authenticate their identity.
Mar 20, 20241.1.6Improvement
A language selection sheet now includes the option for translated languages.
Mar 15, 20241.1.5Improvement
Included a new parameter called "loading_text" within the config object, enabling the modification of the loading text displayed at the initiation of the SDK.
Mar 11, 20241.1.4Improvement
Enhanced socket connection performance for improved reliability on limited internet connections.
Mar 08, 20241.1.3Improvement
Enhanced camera quality and added compatibility with multiple devices.
Feb 23, 20241.1.2Improvements:
1. Enhanced SDK Design: Revamped the overall design of the SDK for improved usability and aesthetics.

2. Cropped Image Display: Incorporated the ability to display cropped images within the document service, enhancing user experience and clarity.

3. AutoCapture Countdown Timer: Integrated a countdown timer in AutoCapture mode for precise document placement within the designated rectangle, ensuring clear and accurate image capture.

4. Image Preview Zoom Functionality: Integrated a zoom feature in the image preview section, enabling users to examine images more closely.

5. Streamlined User Consent: Transitioned user consent from a full-screen display to a more user-friendly dialog box, enhancing accessibility and user interaction.

6. NFC Integration: Implemented Near Field Communication (NFC) functionality within the Onsite SDK, enabling seamless communication with NFC-enabled devices

Additions:
1. Phone and Email Service: Added new services for phone and email functionalities, expanding the range of verification options available within the SDK.
Jan 30, 20241.1.0Improvement
Change Phrase ID of ID Card from 1704 to 17 (National ID to ID Card)
Jan 22, 20241.0.8Improvement
Add missing keys in verification_data object in main response
Jan 18, 20241.0.7Improvement
Fix OCR Calendar issue in arabic language.
Dec 07, 20231.0.4Improvement
Improved the camera functionality of low hardware devices.
Dec 07, 20231.0.3Improvement
Onsite SDK now offers an enhanced user interface along with improved features for localization, OCR Form, and a Retry Option.