Cordova SDK
Getting Started
Latest release: Version 1.0.5
Requirements
- iOS 13.0 and higher Or API level 21 (Android 5.0) or higher
- Internet connection
- Camera
Resources
- Integration Sample: Cordova Sample App
Installation
It’s always recommended to use the updated version
Step 1: Run the following command in your project terminal:
cordova plugin add cordova-plugin-facia-mobile-sdk
Step 2: For iOS: Run pod install on platform/ios main folder.
Step 3: For iOS: Add camera permission to info.plist
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.
var config = {
showVerificationType: true,
showResult: true
};
Initialisation
Facia’s mobile SDK can be initialised by using the given method and passing success callback, error callback, Plugin ID, method namen, token & config object as the parameters.
Plugin ID is "faciaMobileSDK"
Method name is "createRequest"
cordova.exec(
function(result) {
console.log('Facia request success:', JSON.stringify(result));
},
function(error) {
console.error('Facia request error:', result);
},
'faciaMobileSDK',
'createRequest',
["ACCESS_TOKEN", config]
);
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 success and error, if there is error in initiating plugin it will be returened in the error callback else it will be returned in the success callback.
Success Callback
function(result) {
console.log('Facia request success:', result.event);
}
Error Callback
function(error) {
console.error('Facia request error:', result);
}
The complete list of callback events can be found here.
Callback Handling
All the callbacks can be handled from where the client calls the SDK. 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 Termination mid way
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 |
---|---|---|
Nov 17, 2023 | 1.0.5 | Improved Passive Liveness flow & design. |
Nov 08, 2023 | 1.0.0 | Initial release |