API Reference

CARD91 NSDL AADHAAR SDK iOS Implementation

This page will help you get started with NSDL AADHAAR KYC SDK iOS framework installation and usage guide

Card91 NSDL AADHAAR KYC iOS framework

Card91 NSDL AADHAAR KYC iOS framewrok integration with Native iOS Apps

Description

Purpose of this document is to illustrate the method to add Card91 ‘Card91KYC’ framework to any iOS native application written in swift invoked from viewcontroller.

Card91 Card91KYC framework allows developers to launch the Card91KYC view from their application to process and complete the aadhaar XML full KYC for NSDL cards.

Developers need to launch InvokeNSDLSDK from their viewcontroller with some required parameters mentioned below and a library completing the aadhaar KYC for the NSDL cards.

Installation

iOS Minimum Requirements :

Deployment Target - 14.0 or above

Usage

Below steps followed to integrate the Framework

Adding the framework

Add the xcframework file provided by us ( Card91KYC.xcframework and OfflineAadhaar.xcframework )by drag and drop into the project "Frameworks,Libraries, and Embedded Content’ to “Embed & Sign".

Importing the framework

Framework will be ready to use after their adding on ViewController.

Use this Card91KYC framework by importing.

Initialising the InvokeNSDLSDK Instance

Get the instance of the added InvokeNSDLSDK onto your ViewController.
As shown in the example below .
Set the Listener as given below


import UIKit
import Card91KYC

class ViewController: UIViewController,InvokeNSDLSDKCallBackListener {
    
    //overriden function of InvokeNSDLSDKCallBackListener class
    func returnEventDataToCallingApplication(_ screen_name: String, _ event_name: String, _ message: String) {
        print("------ Event Data --------");
        print("Screen Name : ",screen_name); // Optional value used for analytic purpose (ignore if not required)
        print("event name : ",event_name);// Optional value used for analytic (ignore if not required)
        print("Message", message);// Optional value used for analytic (ignore if not required)
    }
  
    //overriden function of InvokeNSDLSDKCallBackListener class
    func returnDataToCallingApplication(_ status: String, _ message: String, _ code: String) {
        print("-------Callback data--------");
        print(status); // Actual event callbacks while processing the addhaar KYC process
        print(message);// Actual event callbacks while processing the addhaar KYC process
        print(code);// Actual event callbacks while processing the addhaar KYC process
        
    }
    
    @IBAction func callingNSDLSDK(_ sender: Any) { /// Called on button click in this particular case
        self.callingNSDLSDK()
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    /// Below is main function which will invoke the SDK
    func callingNSDLSDK(){
        
        DispatchQueue.global(qos: .background).async {
            DispatchQueue.main.async {
                
                let bundle = Bundle(for: InvokeNSDLSDK.self)
                let newVC = InvokeNSDLSDK(nibName: "InvokeNSDLSDK", bundle: bundle)
                newVC.InvokeNSDLSDKwithParams(env: "PROD", // Env ("PROD" in case of production and "PROD_SANDBOX" for production sandbox
                                              auth_token: "C91IP_kgb4LD/PyXXXXXXXXXXXPP9ttgkT8QcPhck=", // Card holder token
                                              mobile: "917708134620", // card holder mobile number 
                                              pan: "", // Should always pass empty since user will enter this value 
                                              org_id: "220215063043444ID1OID7546350") // Business org id
                newVC.delegate = self // Call back methods
                newVC.modalPresentationStyle = .fullScreen
                self.navigationController?.pushViewController(newVC, animated: true) // Navigate one class to another class with UINavigation and allows us to go back
            }
        }
    }
    
}


Important

📘

Note

In order to make sure a registered user successful aadhaar KYC completion, user must invoke the SDK with same mobile number which is linked to aadhaar number and name should be same on PAN number and aadhaar number.

NSDL AADHAAR KYC PROCESS EVENTS

SDK (Framework) went through several steps to make sure KYC happens successfully.
KYC can be completed either through already downloaded aadhaar XML or by validating the aadhaar number through OTP.
Finally SDK validate all the information provided is correct and hence result in FAILED or SUCCESS event call back.
Below some event with meaning.


INPUT PARAMETER DETAILS WHICH LAUNCHING THE FRAMEWORK

NameTypeRequiredDescription
mobilestringtrueRegistered card holder mobile number (12 digit) with 91
auth_tokenstringtrueCard Holder auth token (Card91 API)
envstringtrue"PROD_SANDBOX" for sandbox and "PROD" production environment
panstringfalseNot required now, please keep this as empty
org_idstringtrueBusiness org id

DIFFERENT CALLBACLK EVENTS

The events are as follows:

Event NameDescription
statuson the callback function returnDataToCallingApplication( status: String, message: String, _ code:String)
There is two state of the status which needs to be considered "FAILED" and "SUCCESS"
"FAILED" status will be considered as KYC failed case and "SUCCESS" as success case.
messageBoth on "FAILED" and "SUCCESS" case calling app will receive message which they have to show.
codeIn case of SDK exception code (string) will range from (600-990) and in case of api exception it will range from (400-500)
Eg- 00 as success
401 is auth exception
403 permission exception
400 format exception
404 service not found
500 service error