EKYC Web SDK

The Web SDK for the EKYC system is designed to support drop in integrations between the EKYC infrastructure and a wide spectrum of banking software.

How to setup?#

To use the web SDK is only required to use an iframe (or similar browser component) pointing to https://sdk.kiva.org (Production) or https://pro-sdk.web.app/ (Sandbox). Once the iframe is loaded it will be ready to be controlled using the commands via the standard HTML postMessage interface. For the banking software to receive updates on the EKYC process results the iframe will communicate events, using the same interface.

<script>
function bindEvent(element, eventName, eventHandler) {
if (element.addEventListener){
element.addEventListener(eventName, eventHandler, false);
} else if (element.attachEvent) {
element.attachEvent('on' + eventName, eventHandler);
}
}
window.onload = () => {
var iframeSource = 'http://pro-kyc.web.app';
// Create the iframe
var iframe = document.createElement('iframe');
iframe.setAttribute('src', iframeSource);
iframe.setAttribute('id', 'ekyc_frame');
iframe.style.width = 600 + 'px';
iframe.style.height = 800 + 'px';
document.body.appendChild(iframe);
// Send a message to the child iframe
var sdkFrame = document.getElementById('ekyc_frame').contentWindow;
sdkFrame.postMessage({command: 'openKYC'}, "*");
};
</script>

Commands#

CommandDescription
openEKYCThis is required to activate the EKYC workflow. If this command isn’t send to the iframe, the content won’t respond to input or display any content other than a waiting screen. If the integration requires to keep the iframe loaded to save bandwidth, you can use this command to reset the interface after the previous EKYC was completed.
closeEKYCThis is the required close/stop the EKYC workflow. This command won’t unload the iframe, but will ensure no further user interactions will be processed.

Receive Events#

bindEvent(window, 'message', function (event) {
console.log(event.data);
if(event.data.key === "EKYC_Completed") {
alert(event.data.success ? "We have a match!" : "There wasn't a match. Verify the NIN is correct");
}
});

Events#

EventDescription
EKYC_CompletedThis event is sent by the iframe to the window that creates it to signal that an EKYC workflow was completed. The outcome of the workflow could be a successful match or not.
EKYC_ErrorThis event is sent by the iframe to the window that creates it to signal that an EKYC workflow was interrupted by an unexpected error.