iOS SDK
Getting Started
Latest release:
Requirements
Device Requirement
Resources
Integration
SDK Integration Guide
It’s always recommended to use the updated version and run on physical device to get real results.
- Cocoapods
Make sure your project contains pod file. If it does not, run pod init
command in root of your project directory.
Add following pod to your Podfile
pod 'ShuftiPro-Onsite'
Permissions:
Application Info.plist must contain Privacy - Camera Usage Description with corresponding explanation to end-user about how the app will use these permissions
Basic Usage
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
let authKeys = [
"auth_type" : "access_token",
"access_token" : "xxxxx-xxxxx-xxxxx"
]
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 foundhere
let configs = [
"base_url": "api.shuftipro.com",
"consent_age": 16,
]
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 foundhere
Import Shufti Pro
import ShuftiPro
Request Object
let requestObject: [String: Any] = [
"reference": "Unique reference",
"country": "",
"language": "",
"email": "[email protected]",
"callback_url": "http://www.example.com",
"show_results" : "",
"verification_mode": "image_only",
"face": ["proof": ""],
"document": [
"proof": "",
"additional_proof" :"",
"supported_types": [
"passport",
"id_card"
],
"name": [
"first_name": "",
"last_name": ""
],
"backside_proof_required": "0",
"dob": "",
"document_number": "",
"expiry_date": "",
"issue_date": ""
],
"address": [
"proof": "",
"full_address": "",
"name": [
"first_name": "",
"last_name": ""
],
"supported_types": [
"id_card",
"utility_bill",
"bank_statement"
]
],
"consent":[
"proof" : "",
"text" : "my consent note",
"supported_types" :[
"printed",
"handwritten"
]
]
]
Initialisation
Shufti Pro's mobile SDK can be initialized by using the following method and passing auth, config and request objects as the parameters.
let instance = Shufti()
instance.shuftiProVerification(requestObject: "your-request-object", authKeys: "authentication-keys-object",
parentVC: your viewController from where you want to open ShuftiPro,
configs: "configuration-object"){(result) in
print(result) // Callback response for verification verified/declined
let response = result as! NSDictionary
if response.value(forKey: "event") as? String == "verification.accepted" {
// Verified: Do something
} else {
// Declined: Do something
}
}
Callbacks
The SDK receives callback events as result, whether the verification journey is completed or left mid-way. The call back is received in following function
shufti.shuftiProVerification(requestObject: dataDictionary, authKeys: authKeys, parentVC: self, configs: configs)
{
(result) in
let reponse = result as! NSDictionary
}
The complete list of callback events can be foundhere
Callbacks Handling
All the callbacks can be handled inside the client's calling View/Screen. The response and callback handling code can be seen in the following code snippet
On SDK Completion
let reponse = result as? NSDictionary
if reponse?.value(forKey: "event") as? String == "verification.accepted" {
// Verification Accepted Callback
}
else if reponse?.value(forKey: "event") as? String == "verification.declined"{
// Verification Declined Callback
}
else if reponse?.value(forKey: "event") as? String == "request.received"{
// This event states that the verification request has been received and is under processing.
}
else if reponse?.value(forKey: "event") as? String == "request.pending"{
// This event is returned for all on-site verifications until the verification is completed or timeout.
}
On SDK Unauthentication
if reponse?.value(forKey: "event") as? String == "request.unauthorized"{
// This event occurs when the auth header is not correct and, client id/secret key may be invlaid.
}
On SDK Error
if reponse?.value(forKey: "event") as? String == "request.invalid"{
// The request invalid event occurs when the parameters specified in the request payload are not in the correct format.
}
else if reponse?.value(forKey: "event") as? String == "request.timeout"{
// This will occur if request has timed-out.
}
else if reponse?.value(forKey: "event") as? String == "permission.denied"{
// This event is returned if the user did not give camera and other permissions to sdk.
}
else if reponse?.value(forKey: "event") as? String == "verification.cancelled"{
//This event occurs when the end-user does not agree to the terms and conditions and also occur if in-between user cancel 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.
let configs = [
"base_url": "api.shuftipro.com",
"button_text_color": "#XXXXXX",
"button_primary_color": "#XXXXXX",
"button_secondary_color": "#XXXXXX",
"heading_color": "#XXXXXX",
"sub_heading_color": "#XXXXXX",
"theme_color": "#XXXXXX",
"icon_color": "#XXXXXX",
"background_color": "#XXXXXX",
"stroke_color": "#XXXXXX"
]
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 mentionhere
NFC verification
Near Field Communication (NFC) is a set of short-range wireless technologies. NFC allows sharing of small data payloads 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 can be verified.
Installation
Step 1
Application Info.plist must contain a Privacy - Camera Usage Description and Privacy - NFC Scan Usage Description key with an explanation to the end-user about how the app uses this data.
Step 2
And Open your Info.plist file as Source Code add these lines inside the dict tag.
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>00000000000000</string>
<string>A0000002471001</string>
</array>
Step 3
In your Project target, add under the Signing and Capabilities section, tap on Capabilities and add Near Field Communication Tag Reading.For more guidance watch this guided imagehere
Step 4
Add this dependency into your project's Podfile.
pod 'ShuftiProNFC'
Step 5
Please make sure to add the following post-install hook to your Podfile.
post_install do |installer|
installer.aggregate_targets.each do |target|
target.xcconfigs.each do |variant, xcconfig|
xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
xcconfig_path = config.base_configuration_reference.real_path
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end
if ['OpenSSL-Universal'].include? target.name
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
To check NFC supported documents and countries, please clickhere
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
var instance = Shufti()
instance.register(clientID: "client_id", customerID: "customer_id", configs: configs) { result in
print(result)
}
The details of parameters can be foundhere
Step 2
Destroying the SDK Instance
To clean up and destroy the SDK instance, call the destroy method.
instance.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 foundhere
You will receive the following response from the API call.
{
"error": false,
"message": "customer journey created successfully"
}
The details of parameters can be foundhere
Revision History
Date | SDK Versions | Description |
---|---|---|
Aug 26, 2024 | 1.3.0 | Improvement Added new service of Enhance Due Deligence. |
Aug 26, 2024 | 1.2.9 | Improvement Improve the branding of shuftipro. |
Aug 26, 2024 | 1.2.8 | Improvement Improve the memory management of mobile SDK. |
Aug 27, 2024 | 1.2.6 | Improvement Improve the phrases in case of arabic langauge. |
Aug 26, 2024 | 1.2.5 | Improvement Handle the video preview when permission is granted for the first time. |
Aug 19, 2024 | 1.2.4 | Improvement Added functionality to implement a white label solution. |
Aug 05, 2024 | 1.2.3 | Improvement Improved the phrases translation in case of traditional Chinese language. |
Jul 31, 2024 | 1.2.2 | Improvement Updated the design and user experience of the upload screen & fixed the merchant logo issue in case of SVG image. |
Jul 19, 2024 | 1.2.1 | Improvement We implemented 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. Reduced the loaders to improve the verification journey. |
Jul 03, 2024 | 1.2.0 | Improvement We implemented the following features in the mobile SDK: 1. Implemented Journey Builder. 2. Added support for the merchant logo at the footer. 3. Added support for simulators. |
Jun 21, 2024 | 1.1.11 | Improvement Improved the functionality of SDK in case of empty language field. |
Jun 12, 2024 | 1.1.10 | Improvement We implemented 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 15, 2024 | 1.1.9 | Improvement Added support for XCode version 15.4. |
May 03, 2024 | 1.1.8 | Improvement Improve your theme customization 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: Customize the color of the Shuftipro icon in both light and dark modes. For further details, refer to the [customization](#customization) section in the documentation. |
Apr 24, 2024 | 1.1.6 | Improvement Enhanced the consent screen and improved the user experience of the SDK. |
Apr 22, 2024 | 1.1.5 | Improvement Enhanced the autocapture countdown logic within the Camera Screen. |
Apr 18, 2024 | 1.1.4 | Improvement Resolved the API 401 issue on the verification result screen. |
Apr 17, 2024 | 1.1.3 | Improvement We 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, 2024 | 1.1.2 | Improvement Included 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, 2024 | 1.1.1 | Improvement Implemented a new feature for face liveness verification, requiring users to align their faces with multiple overlays to authenticate their identity. |
Mar 20, 2024 | 1.1.0 | Improvement A language selection sheet now includes the option for translated languages. |
Mar 18, 2024 | 1.0.10 | Improvement 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 13, 2024 | 1.0.9 | Improvement Added support for XCode version 15.3. |
Feb 23, 2024 | 1.0.7 | Improvements: 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. |
Dec 19, 2023 | 1.0.4 | Improvement Added support for XCode version 15.1. |
Dec 13, 2023 | 1.0.3 | Improvement Improved user experience of iOS SDK. |
Dec 13, 2023 | 1.0.2 | Improvement Onsite SDK now offers an enhanced user interface along with improved features for localization, OCR Form, and a Retry Option. |