How to Integrate?
- On terminal, cd to your Xcode project root directory (where your .xcodeproj file)
- pod init -> This will create a podfile.
- Add the following line to your podfile
- pod 'DigiokycSDK'
- pod 'DigioCaptureKit' (Optional for selfie)
- pod install
- Close all session of xcode projects and open your project again.
Create SDK configuration
1. Import the Digio module
import DigiokycSDK
2. Configure Digio instance
do {
try DigioKycBuilder()
.withController(viewController: self) // Mandatory pass your view controller here
.setEnvironment(environment: .SANDBOX) // Mandatory: SANDBOX / PRODUCTION
.setDocumentId(documentId: "DID**") // Mandatory Unique MandateId /Document ID
.setIdentifier(identifier: "email/phone") // Mandatory identifier
.setKycResponseDelegate(delegate: self) // Optional delegate
.setFontFormat(fontFormat: "")
.setFontFamily(fontFamily: "")
.setFontUrl(fontUrl: "")
.setTokenId(tokenId: "GWT**") // Optional:- token id to bypass first factor authentication
.setLogo(logo: "") //optional your logo link
.setAdditionalParams(additionalParams: [:]) //Optional:- Additional Params
.build()
} catch {
print("Exception --> \(error.localizedDescription)")
}
3. Handle SDK response
- Implement DigioKycResponseDelegate, add onDigioKycResponseSuccess, onDigioGatewayEvent & onDigioKycResponseFailure protocol stubs
extension YourViewController : DigioKycResponseDelegate {
func onDigioKycResponseSuccess(successResponse: String) {
print("Success \(successResponse)")
}
func onDigioKycResponseFailure(failureResponse: String) {
print("Failure \(failureResponse)")
}
func onGatewayEvent(event: String) {
print("DigioGatewayEvent \(event)")
}
}
4. Permissions need to add in your info.plist
/** Camera permission incase of selfie/video KYC/ capture document **/
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your camera.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your photo.</string>
/** Microphone permission incase of video KYC **/
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your microphone to capture video.</string>
/** Location permission for geo tagging for camera/video kyc/ selfie **/
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
Note : All permissions should be checked and taken before triggering Digio SDK
- GatewayEventResponse
{
"txnId": "2.5601690357804383",
"documentId": "KID230303132625594XWVBSZBSZO7ZXS",
"event": "kyc.initiated",
"identifier": "email@domain.com",
"entity": "kyc"
}
- Sample Response
{
"status": "success",
"id": "KID230406115342351F7MJ4I2KISPA6O",
"code": 1001,
"message": "KYC Process Completed."
}
{
"status": "failure",
"id": "KID230406115342351F7MJ4I2KISPA6O",
"errorCode": 1002,
"code": 1002,
"message": "failure message based on the case"
}
{
"message": "Cancelled By User",
"code": -1000,
"id": "KID230406115342351F7MJ4I2KISPA6O",
"status": "cancel"
}
- Cancel case
- Failure case
- Success case
Version Details below
- Platform = ios
- Ios.deployment_target = 15.6
- Swift_version = 5.7.2
- Xcode_version = 16.2
Possible Error Codes and Reason
| code/errorCode | Description |
|---|---|
| 1001 | Success |
| 1002 | Kyc Process Failed |
| -1000 | Cancelled By User |
| 1008 | Location/Camera/MicroPhone Permission Denied By User |
| 10017 | WebView Error |
Additional error code with reason(In case of Offline Kyc)
| code/errorCode | Description |
|---|---|
| 1005 | You have exceed OTP attempts |
| 10012 | Aadhaar number does not have mobile number |
| 10014 | UIDAI Exceeded Maximum OTP generation Limit. Try after sometime |
| 10015 | |
| 10016 | UIDAI server error. Please try again in some time. |
| 10018 | UIDAI technical issue please try after some time |
| 10019 | UIDAI could not be loaded please try after some time. |