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:
|
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:
|