Free Payment Gateway & Online Store in India, Online Payments & eCommerce Made Easy - Instamojo

Instamojo is one of the top rated payment gateway & eCommerce platform in India. Trusted by 1,200,000+ Indian small businesses as their one-stop payments platform for anything payments related. 100% Secure, Fast payment gateway services integration. No setup cost. No maintenance cost. Supports Netbanking, Credit, Debit Cards, UPI etc.

This integration method works with an external thank you page and Instamojo API to get the details about the order.


Get the API key and Auth Token

Login to your Instamojo account and navigate to API & Plugins. At the top copy the Private API Key and Private Auth Token.


Enable the tracking plugin

Log in to your Post Affiliate Pro merchant panel and navigate to Configuration->Plugins and activate the Instamojo API and notification handling plugin. Once the plugin is active click Configure and enter your API Key and Auth Token from the previous step.


Add sale tracking code to the thank you page

Insert the following tracking code into your external thank you page to which customers are redirected after placing a payment with Instamojo.

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
    var payment_id = getParameterByName('payment_id');
    var callBack = false;

    function getVisitorId() {
        return PostAffTracker._getAccountId() + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();

    function visitorCallBack() {
      if (callBack == false && "null" != getVisitorId()) {
        callBack = true;
        var pixel = document.createElement("img");pixel.width=1;pixel.height=1;
        pixel.src = 'https://URL_TO_PostAffiliatePro/plugins/Instamojo/instamojo.php?visitorId=' + getVisitorId() + '&payment_id=' + payment_id;

    function getParameterByName(name, url = window.location.href) {
        name = name.replace(/[\[\]]/g, '\\$&');
        var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
            results = regex.exec(url);
        if (!results) return null;
        if (!results[2]) return '';
        return decodeURIComponent(results[2].replace(/\+/g, ' '));

    try {
    if (payment_id != null) {
        if (getVisitorId() != null && getVisitorId().indexOf('null') != -1) {
            setTimeout(function() {visitorCallBack();}, 1800);
            PostAffTracker.executeOnResponce.push(function() {visitorCallBack();});
        else {

Save the code.

Do not forget to integrate your web site with the click tracking code so the sale tracking will work correctly.