Skip to main content

React Native SDK

Getting Started

Latest release: Version 0.5.9

Requirements

  1. iOS 13.0 and higher Or API level 21 (Android 5.0) or higher
  2. Internet connection
  3. Camera

Resources

Installation

tip

It’s always recommended to use the updated version

Step 1: Run the following command in your project terminal:

npm i facia-mobilesdk

Step 2: Include the Facia module by adding the import statement at the top of your main project file.

import { NativeModules } from 'react-native';
const { FaciaReactNativeModule } = NativeModules;

Step 3: For Android: goto ProjectName/android/app/build.gradle and update minSdkVersion version to 21.

  minSdkVersion = 21

Basic Usage

Note

Make sure you have obtained authorization credentials before proceeding. You can get Login credentials (email & password) by contacting to Facia support team

Authorization

For authorization, Facia's SDKs require Access token. You can get access token from the API: https://app.facia.ai/backend/api/transaction/get-access-token/

Request Object

ParametersDescription
emailRequired: Yes
Type: String
passwordRequired: Yes
Type: String

Configuration

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

const config = {
"showConsent": true,
"showVerificationType": true,
"showResult": true,
};

Initialisation

Facia’s mobile SDK can be initialised by using the given method and passing token and config object as the parameters.

FaciaReactNativeModule.verify('ACCESS_TOKEN', JSON.stringify(config), (res) => {
const parsedResponse = JSON.parse(res);
console.log('event:', parsedResponse);
});

Callbacks

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

FaciaReactNativeModule.verify('ACCESS_TOKEN', JSON.stringify(config), (res) => {
const parsedResponse = JSON.parse(res);//receiving response from callback
console.log('event:', parsedResponse);//getting event from response
});

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

3D Liveness

if (event === "verification.accepted") {
// Verification accepted callback
}
else if (event === "verification.declined") {
// Verification declined callback
}

Photo ID Match

if (event === "photo_id.match_success") {
// Verification accepted callback
}
else if (event === "photo_id.match_failure") {
// Verification declined callback
}

On SDK Error

if (event === "permission.denied") {
// This callback is returned in case the permissions are declined by the end user.
}
else if (event === "request.timeout") {
// This callback is returned in case request took too long and is timed out
}
else if (event === "request.cancelled") {
// This callback is returned when verification is cancelled midway by the end user
}
else if (event === "error.occurred") {
// This callback is returned if the API request faces any issue
}
else if (event === "emulator.detected") {
// This callback is returned if the SDK is running on an emulator
}
else {
// Some error has been occured during the verification process
}

Revision History

DateSDK VersionsDescription
May 28, 20240.5.9Features improvement.
May 28, 20240.5.6UI/UX updated.
Apr 21, 20240.5.5Improved liveness instructions.
Mar 26, 20240.5.2Update Depedencies.
Mar 15, 20240.4.9Updated Dependencies.
Nov 17, 20230.4.6Improved Passive Liveness flow & design.
Nov 02, 20230.3.9Improved functionality and design
Sep 26, 20230.3.83D Liveness & Photo ID Match features are added.