React Native SDK
Getting Started
Latest release: Version 0.5.9
Requirements
- iOS 13.0 and higher Or API level 21 (Android 5.0) or higher
- Internet connection
- Camera
Resources
- Integration Sample: React Native Sample App
Installation
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
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
Parameters | Description |
---|---|
Required: Yes Type: String | |
password | Required: 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
Date | SDK Versions | Description |
---|---|---|
May 28, 2024 | 0.5.9 | Features improvement. |
May 28, 2024 | 0.5.6 | UI/UX updated. |
Apr 21, 2024 | 0.5.5 | Improved liveness instructions. |
Mar 26, 2024 | 0.5.2 | Update Depedencies. |
Mar 15, 2024 | 0.4.9 | Updated Dependencies. |
Nov 17, 2023 | 0.4.6 | Improved Passive Liveness flow & design. |
Nov 02, 2023 | 0.3.9 | Improved functionality and design |
Sep 26, 2023 | 0.3.8 | 3D Liveness & Photo ID Match features are added. |