New WebPAY Pop-Up Implementation
This can be used by customers who want to keep the customer experience look and feel of their website intact.
Transaction Payment Leg
Payment leg is achieved via below script sent to service URL http://sandbox.interswitchng.com/collections/public/webpay.js.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<html> <head> <script type="text/javascript" src="http://sandbox.interswitchng.com/collections/public/webpay.js"></script> </head><body onload="document.myform.submit()"> <script> $(document).ready(function (){ var iswPay = new IswPay({ postUrl:"https://sandbox.interswitchng.com/collections/w/pay", amount: 10000, productId: "1076", transRef: "4327408aaa", siteName: "test merchant site", itemId: "101", customerId: "000001", siteRedirectUrl: "http://localhost:8080/webpopupnew.html", currency: "NGN", hash: "A6485CE39EAF476985A89FA74065A992279AB747A7B7FB4032CED18A92A4F0BA9E7C9BC81A6E5A1A469F", onComplete : function (paymentResponse){ console.log(paymentResponse); } }); }); </script> </body> </html> |
Complete merchant details to use can be found below:
1.5% Fee New WebPAY Details (NO SPLIT XML)
1.5% to a cap of N2,000 Transaction Fee for New WebPAY Details (NO SPLIT XML)Field Name | Expected Value | Comments |
---|---|---|
product_id | 1076 | |
pay_item_id | 101 | |
Mac Key | D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F |
Server Response – Object paymentResponse
Aside the normal GET Transaction request to confirm transaction status (see here for more details) it is also possible to receive the results of a transaction from an object returned called paymentResponse.
1 2 3 4 5 6 7 8 9 10 11 |
var myObject = JSON.stringify(paymentResponse); document.getElementById("response").innerHTML = myObject; document.getElementById("ResponseDescription").innerHTML = paymentResponse.desc; document.getElementById("ResponseCode").innerHTML = paymentResponse.resp; document.getElementById("RedirectURL").innerHTML = paymentResponse.url; document.getElementById("TransactionRef").innerHTML = paymentResponse.txnref; document.getElementById("ApprovedAmount").innerHTML = paymentResponse.apprAmt; document.getElementById("ReturnedReference").innerHTML = paymentResponse.retRef; document.getElementById("CardNumber").innerHTML = paymentResponse.cardNum; document.getElementById("MAC").innerHTML = paymentResponse.mac; |
1 |
{"resp":"Z6","url":"http://localhost/NewWebPAYX/popup/index.php","desc":"Customer cancellation","payRef":"JB1944513","retRef":"","txnref":"JB1944513","apprAmt":123400,"amount":123400,"cardNum":"","mac":""} |
You can find a complete working script in the Sample Code section.