Flutter Plugin
Getting Started
Latest release: Version 1.2.2
Requirements
- iOS 13.0 and higher Or API level 23 (Android 6.0) or higher
- Internet connection
- Camera
Resources
Integration Sample (Dart): Shufti Pro Flutter-SDK
Installation
See the sample [project] (https://github.com/shuftipro/Flutter-SDK) provided to learn the most common use. Make sure to build on real devices.
Step 1: Run this command: dart pub add shuftipro_sdk
with dart or flutter pub add shuftipro_sdk
with flutter
Or
Add dependency in pubspec.yaml
as dependencies: shuftipro_sdk: ^1.2.2
Step 2: Go to project
> android
> build.gradle
file and add the following
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add this line
}
}
Step 3: Import this 'package:shuftipro_sdk/ShuftiPro.dart' in your class in order to send the request to ShuftiPro's SDK.
It’s always recommended to use the updated version
Basic Usage
Make sure you have obtained the client id and secret key or access token before proceeding
Authorization
Shufti Pro provides two types of authorization to its users. The following shows the code snippet of how to use the authorization keys to authenticate the SDK.
Basic Auth
Make auth object using client id and secret key
Map<String,Object> authObject = {
"auth_type": "basic_auth",
"client_id": clientId,
"secret_key": secretKey,
};
Access Token
Or make auth object using access token
Map<String,Object> authObject = {
"auth_type": "access_token",
"access_token": accessToken,
};
You can get client id or secret key and generate access token like this
Configuration
The Shufti Pro's mobile SDKs can be configured based on the parameters provided in the config object.
Make config object
Map<String,Object> configObject = {
"open_webview": false, // pass true for verification through hybrid view
"asyncRequest": false,
"captureEnabled": false,
"dark_mode": false,
};
Config object parameters are explained here.
Request Object
This object contains the service objects and their settings through which the merchant wants to verify end users.
Request Object
Map<String, Object> createdPayload = {
"country": "US",
"reference": "12345678",
"language": "EN",
"email": "",
"verification_mode": "image_only",
"show_consent": 1,
"show_results": 1,
"show_privacy_policy": 1,
"face": {},
"background_checks": {},
"phone": {},
"document": {
"supported_types": [
"passport",
"id_card",
"driving_license",
"credit_or_debit_card",
],
/* Keep name, dob, document_number, expiry_date, issue_date empty for with-OCR request*/
"name": {
"first_name": "John",
"last_name": "Johsan",
"middle_name": "Livone",
},
"dob": "",
"document_number": "19901112",
"expiry_date": "1996-11-12",
"issue_date": "1990-11-12",
"gender": "M",
"backside_proof_required": "1",
},
//Creating Document Two Object is exactly the same as document object.
"address": {
"full_address": "ST#2, 937-B, los angeles.",
"name": {
"first_name": "Johon",
"last_name": "Johsan",
"middle_name": "Livone",
},
"supported_types": ["id_card", "utility_bill", "bank_statement", "passport", "driving_license"],
},
/* Keep name and full_address empty for with-OCR request */
"consent": {
"supported_types": ["printed", "handwritten"],
"text": "My name is John Doe and I authorise this transaction of \$100/-",
},
};
Request Object parameters are explained here.
Initialisation
Shufti Pro's mobile SDK can be initialized using the given method and passing auth, config and request objects as the parameters.
ShuftiproSdk.sendRequest(authObject: authObject,
createdPayload: createdPayload, configObject: configObject);
Verification Types
Native Flow
In the native verification flow, the end-user interacts with the native mobile SDK. The native flow of verification tends to be much faster since the whole app depends on the device's processing power for the verification process. Also, all the proofs are taken for all services in native flow first and then and only then, is a request made to the server in the form of JSONObject.
You can enable native flow by passing false
for open_webview
key in Config
object.
Config.put("open_webview",false);
Hybrid Flow
The hybrid verification flow includes mobile verifications on a web view built on HTML 5 that will show the verification process to the end user. End-user provides the information in the online customer onboarding process. In hybrid flow, proofs are uploaded as every service is performed, verification results are shown simultaneously in case of decline, and the user can retry the request.
You can enable native flow by passing true
for open_webview
key in Config
object.
Config.put("open_webview",true);
In both flows, Shufti Pro provides the facility to their customers to tailor the identity verification services according to their needs.
SDK Flow

Callbacks
Callbacks are received whenever the SDK is terminated or closed, whether after request completion or if the user leaves the verification journey mid-way. The function will return the response to the verification. You can save or do whatever you want with the response.
var response = await ShuftiproSdk.sendRequest(authObject: AuthObject,
createdPayload: createdPayload, configObject: ConfigObject);
Following is the list of callbacks we receive in the above function.
Keys | Values | Description |
---|---|---|
Event | request.unauthorized | The auth header is not correct and, client id/secret key may be invlaid. |
Event | request.pending | This event is returned for all on-site verifications until the verification is completed or timeout. |
Event | verification.accepted | Verification accepted callback |
Event | verification.declined | Verification declined callback |
Event | permission.denied | This event is returned if the user did not give camera and other permissions to sdk. |
Event | request.timeout | This will occur if request has timed-out |
Event | verification.cancelled | This callback is returned when verification is cancelled midway by the end user |
Event | request.received | This event states that the verification request has been received and is under processing |
Event | request.invalid | The request invalid event occurs when the parameters specified in the request payload are not in the correct format. |
Error | Internet Connection Error | This callback is returned in case of lost internet connectivity |
You can check complete response of shuftipro from here
Customisation
ShuftiPro supports a set of customization options that will influence the appearance of the mobile SDK.
Verification flow and UI
The complete verification journey is customisable. To remove the screen from verification flow, you need to provide that parameter to the SDK through request/config object. For instance;
Request Object
"show_consent" : "0" // providing this parameter 0 value will hide the verification consent screen
"country" : "GB" // providing a value to this parameter will not ask the end user to provide his country
"verification_mode" : "image_only" // "image_only" or "video_only" values will allow you to avoid mode selection at real-time
"show_privacy_policy" : "0" // value will remove the privacy policy content shown at result screen
"allow_online" : "1" // 1 value will ask the user to capture real time proofs(image or video) depending upon verification mode
"allow_offline" : "1" // 1 value will ask the user to upload proofs(image or video) depending upon verification mode
"decline_on_single_step" : "1" // this parameter will work with onsite flow(open_webview : true). This will show continue the journey only if pervious step is successfully verified
"show_feedback_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will ask the user for its feedback at the end of verification
// Service Level Parameters
"supported_types" : [id_card] // providing a single value to this parameter will not ask the user for document type
"show_ocr_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will show the OCR form to the user
Config Object
"asyncRequest": "true" // passing true value to this parameter will not show result screen to the user and will just return the callback on request completion
Dark mode
To apply dark theme/mode in SDK, initialize the SDK with provided parameters in the config object.
...
"dark_mode" : false,
Android
To customize the UI of your Android module, you can add the related files in the "android>app>src>main>res>values" directory.
Colours
The colour of buttons and font can be customised by overriding the values of following variables in the project's color.xml
file.
<color name="light_button_color">#2B6AD8</color>
<color name="light_text_color">#1D2C42</color>
<color name="dark_button_color">#FF7A77</color>
<color name="dark_text_color">#ffffff</color>
<color name="button_text_color">#FFFFFFFF</color>
Localization
Shufti Pro provides its users with the facility to translate the SDK entirely into their desired language or customize the text of the SDK according to their requirements. The client can customize the text of the SDK by changing the values of the corresponding variables given in this strings.xml file. The user must override the values of desired variables in their project's strings.xml file.
IOS
To customize the UI of your iOS module, you can follow the following steps.
Colours
To customize the colours of your iOS module, you can use hex values of choice in the config object.
Map<String,Object> configObj = {
...
"font_color": "#263B54",
"button_text_color": "#FFFFFF",
"button_background_color": "#1F5AF6",
}
Localization
Shufti Pro provides its users with the facility to translate the SDK entirely into their desired language or customize the text of the SDK according to their requirements. Add your own Localizable.strings file to your ios project using standard iOS localization mechanism. To change a specific text, copy the file from here and override the corresponding keys.
Changelog
SDK Versions | Changes |
---|---|
1.2.0 |
|
1.1.9 |
|
1.1.8 |
|
1.1.7 |
|