upi payment javascript ajax php

Viewed 14
        <script>
    
            const createQueryParams = params =>
                Object.keys(params)
                    .map(k => `${k}=${encodeURI(params[k])}`)
                    .join('&');
    
            function upi() {
                var baseurl = "upi://pay?";
                var mam = 'null';
                var cu = 'INR';
                const mobile = document.getElementById("mobile").value;
                const email = document.getElementById("email").value;
                var pa = document.getElementById("pa").value;
                var pn = document.getElementById("pn").value;
                var am = document.getElementById("am").value;
                var tr = document.getElementById("tr").value;
                var tn = document.getElementById("tn").value;
                var data = { 'pa': pa, 'pn': pn, 'am': am, 'tr': tr, 'tn': tn, 'mam': mam, 'cu': cu};
                const querystring = baseurl + createQueryParams(data);
                console.log(querystring);
                
                $.ajax({
                type: "POST",
                url: "payment-proccess.php",
                data: {querystring:querystring, mobile:mobile, email:email}
                }).done(function( res ) {
                //TODO
                var response = JSON.parse(res);
                console.log(response);
                if (response) {
                    $('#alert-success').show();
                    $('#response').show();
                    // $('#upiLink').html(response.upiLink);
                    // $('#shortURL a').html(response.shortURL);
                    // $('#shortURL a').attr("href",response.shortURL);
                    var loc = "https://api.qrserver.com/v1/create-qr-code/?data="+encodeURIComponent(response)+"&amp;size=100x100";
                    $('#qr img').attr("src",loc);
                } else {
                    $('#alert-danger').show();
                }
                });
            }
    
        </script>

Am new to php and am trying to gpay upi transcation my money has send but the problem is how to get the responce from money recived message confirm message from gpay in india please help me to solve this.

0 Answers
Related