Steps to Integrate Web Application with JavaScript SDK


1.Include JS and CSS file in header section.

<head>
<title>mATMSDK</title>
<!-- mATM SDK -->
<script type='text/javascript' src='isuSDK.min.js'></script>
<link rel="stylesheet" href='isuSDK.min.css'>
</head>

2.Client Ref Id, apiusername, pagename, isreceipt, token variables and callback URL are to be initialized.

var apiusername = ?; // This is the API user name, e.g.-isutest
var username = ?; // This is the retailer/agent user name.
var clientrefid = ?;// This is a unique alphanumeric string having max length<=20
var pagename = ?; // This is the transaction type. e.g. CASH_WITHDRAWAL", "BALANCE_ENQUIRY"
var isreceipt = ?;// e.g.- true/false
var callbackurl = ?;// This is a client URL where we post the transaction response to generate receipt if isreceipt =true.
var cd_amount = ?;// This is the cash withdrawal amount when page name= CASH_WITHDRAWAL.
var token = ?// Encrypted token
var passkey = ?// Pass key
let check = isreceipt === "false" && callbackurl !== "";

Note:

  1. 'pagename' should be "CASH_WITHDRAWAL", "BALANCE_ENQUIRY".
  2. 'isreceipt' value should be "true", "false" ( if 'isreceipt’ value is true, ,then you will use our sdk generated receipt else, you will create your own receipt with the data which posted to your calback url.)
  3. token should be an encrypted string.

3.Enable location on your browser.

watchLocation();
function watchLocation(){ if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition( (position)=>{ this.positionNew=position.coords;
},
error=>{ if(error.code===1){
this.locationAlerts(false,error.message);
} elseif(error.code===2){
}
}
);
}
else{ this.locationAlerts(true,'');}
}
function locationAlerts(type,msg){ let alertHtml = type;
if (alertHtml){
} else{ alert(msg);
window.location.href="error.html";
}
}

4.Finally initialize SDK.

isuSDK("#mATM").open({
closeButton: true,
title: "<img src='logo.png' width='' height='' alt='mATM'>",
className: "zoom-and-spin",
clientRefId: clientrefid,
inputParam: apiusername,
pagename: pagename,
token: token,
passkey: passkey,
cd_amount: cd_amount,
username: username,
isreceipt: isreceipt,
callbackurl: callbackurl,
paramA: "",
paramB: "",
paramC: ""
});

5.This is to be added in the page in-order to return back to the initial page after a transaction and perform
different transactions according to your requirements.

window.addEventListener("message", function (event) {
if (event.data === "transactionCpmpleted") {
const ele = document.getElementsByClassName('isuSDK-overlay');
const ele2 = document.getElementsByClassName('zoom-and-spin');
// const ele3 = document.getElementsByClassName('isuSDK-open');
const ele4 = document.getElementsByClassName('isuSDK-modal'); ele[0].remove();
ele2[0].remove();
// ele3[0].remove();
ele4[0].remove();
}
});

Note:

  1. The above content for integration are available in index.html page i.e. the zip file shared with you. And clientrefid value should be unique for each transaction.
  2. Each transaction request will be valid for 3 minutes, if it exceeds this limit; the page will be automatically closed.