Reply
Regular Contributor
Posts: 69
Registered: ‎03-21-2017

Cancel Button not working in accept hosted iFrame with IE

Hi Team,

I have implemented accept hosted payment form with iframe with light box container, this implementation working finr with Chrom,FF.

 

But now the problem is Cancel button is not currectly working in IE. I am not getting any response message in my communicator page also.

When i click on Cancel button it reload my page inside iFrame without closing iframe.

 

Here is my return parameter detials that i am passing during token generation :

SettingType setting7 = new SettingType();
setting7.setSettingName("hostedPaymentReturnOptions");
setting7.setSettingValue("{\"showReceipt\": false, \"url\": \"https://localhost:8443/AuthorizeDemo/home.jsp\",\"cancelUrl\": \"https://localhost:8443/AuthorizeDemo/\"}");

Please note: it is working fine with chrom,FF.

 

All Star
Posts: 699
Registered: ‎11-03-2016

Re: Cancel Button not working in accept hosted iFrame with IE

Hi @raviparmarce88,

 

It might be more helpful to post whatever JavaScript code you're using to listen for the cancel message. Can you add some code to log every message coming in to the console before your script takes action so that you could verify whether or not the cancel message is being passed?

 

 

Highlighted
Member
Posts: 2
Registered: ‎10-10-2017

Re: Cancel Button not working in accept hosted iFrame with IE

I'm using the modal approach and desire the cancel button to simply close the modal.  I found that unless I provided a cancelUrl in the hostedPaymentReturnOptions when requesting the token that the cancelContinueBtnHandler message would not be communicated via the IFrameCommunicator.  

 

With the cancelUrl set to a non empty string it works as expected.

Without the cancelUrl set it does NOT work.

 

JavaScript code to listen for the cancel message:

 

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;
}

CommunicationHandler.onReceiveCommunication = function (argument) {
params = parseQueryString(argument.qstr)

switch (params['action']) {
case "resizeWindow":
    if (parseInt(params['height']) < 1000) {
        params['height'] = 1000;
    }
    $("#load_payment").outerHeight(parseInt(params['height']));
    break;
case "cancel":
    $('#paymentModal').modal('toggle');
    break;
case "transactResponse":
    var transResponse = JSON.parse(params['response']);
    $('#paymentModal').modal('toggle');
    $.post("/pay/CompletePayment", {
       transcationIdentifier: transResponse.orderInvoiceNumber,
       transId: transResponse.transId
     }, function (data) {
       window.location.href = "Success?id=" + transResponse.orderInvoiceNumber;
});
break;
}
}