cancel
Showing results for 
Search instead for 
Did you mean: 

accept hosted - Response of payment checkout from iFrame .

Hi All,

Is there any way by which I can get particular token value in hosted payment form checkout response from iFrame.

 

Can anyone share full response with all possibilities which we are getting after payment submission from the accept hosted form from iFrame.

 

Thanks in Adanace .

raviparmarce88
Regular Contributor
1 REPLY 1

With the following you could put the parsed response into a variable named transResponse:

<script>
    window.CommunicationHandler = {};
    function parseQueryString(str) {
        var vars = [];
        var arr = str.split('&');
        var pair;
        for (var i = 0; i < arr.length; i++) {
            pair = arr[i].split('=');
            vars[pair[0]] = unescape(pair[1]);
        }
        return vars;
    }
    window.CommunicationHandler.onReceiveCommunication = function (argument) {
        params = parseQueryString(argument.qstr)
        parentFrame = argument.parent.split('/')[4];
          switch (params['action']) {
            case "transactResponse":
                var transResponse = JSON.parse(params['response']);
                $('#demo').html(transResponse.transId); // Transaction Id is here
               
        }

    }

</script>

<div id="demo"></div>

An example of the accessible results is :

{"accountType":"Visa","accountNumber":"XXXX0027","transId":"40005451341","responseCode":"1","authorization":"D908O8","billTo":{"phoneNumber":"1231231234","firstName":"Ellen","lastName":"Johnson","company":"Souveniropolis","address":"14 Main Street","city":"Pecan Springs","state":"TX","zip":"44628","country":"USA"},"shipTo":{},"orderDescription":"Product Description","taxAmount":"4.26","shippingAmount":"4.26","dutyAmount":"8.55","customerId":"99999456654","totalAmount":"0.50","poNumber":"456654","orderInvoiceNumber":"INV-12345","dateTime":"7/19/2017 3:43:19 PM"}"

 

 

 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor