cancel
Showing results for 
Search instead for 
Did you mean: 

Iframe communicator loading issue

Hello,

We have an issue with one of our customers that are using integration with Authorize.net using hosted forms. From the logs it looks like sometimes iframe communicator fails to load and we do not receive any messages from authorize net on successful save of payment profile. This results in a situation when payment profile is created on authorize.net’s side and is not created in our system.

Here is communicator code with additional logging that we have added:

 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Payment Communicator</title>
<script type="text/javascript">
function getXmlHttp()
                {
                               var xmlhttp;
                               try
                               {
                                               xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                               } catch (e)
                               {
                                               try
                                               {
                                                               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                                               } catch (E)
                                               {
                                                               xmlhttp = false;
                                               }
                               }
                               if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
                               {
                                               xmlhttp = new XMLHttpRequest();
                               }
                               return xmlhttp;
}
function log(data)
{
                var id = localStorage.getItem("debugid");
                if (!id)
                {
                               id = Date.now();
                               localStorage.setItem("debugid", id);
                }
                try{
                var xmlhttp = getXmlHttp()
                var data1;
                try{ 
                               data1 = encodeURIComponent(JSON.stringify(data.data + "$" + data.origin));
                }catch(e){
                               data1 = data;
                }
                
                xmlhttp.open('GET', '/notarealurl/' + id + "/" + data1, true);
                xmlhttp.send(null);
                }catch(e){}
}
function moreHandlers(addListener) {
    try {
        var panel = window.parent.parent.document.getElementById('paymentPanel');
        panel[addListener]('click', function (e) { log({'data':'cancelClicked', 'origin':'self'})});
        window.parent.parent[addListener]('beforeunload', function (e) { log({'data':'unloadAttempt', 'origin':'self'}) });
    } catch (ex) {
        setTimeout(function () {
            try {
                var panel = window.parent.parent.document.getElementById('paymentPanel');
                panel[addListener]('click', function (e) { log({ 'data': 'cancelClicked', 'origin': 'self' }) });
                window.parent.parent[addListener]('beforeunload', function (e) { log({ 'data': 'unloadAttempt', 'origin': 'self' }) });
            } catch (ex) { log({'data':'moreHandlersFailed', 'origin':'self'}) };
        }, 200);
    }
}
log({'data':'loaded', 'origin':'self'})
if (window.addEventListener)
{
    window.addEventListener("message", log, false);
    moreHandlers('addEventListener');
} else if (window.attachEvent)
{
    window.attachEvent("onmessage", log);
    moreHandlers('attachEvent');
}
log({'data':'test', 'origin':'self'})
function callParentFunction(str) {
  if (str && str.length > 0 && window.parent && window.parent.parent 
    && window.parent.parent.px_callback && window.parent.parent.px_callback.paymentCallback)
  {
      log({ 'data': 'beforeProcessing:' + str, 'origin': 'self' });
    window.parent.parent.px_callback.paymentCallback(str);
    log({ 'data': 'afterProcessing:' + str, 'origin': 'self' });
      // If you get an error with this line, it might be because the domains are not an exact match (including www).
  }
}

function receiveMessage(event) {
  if (event && event.data) {
    callParentFunction(event.data);
  }
}

if (window.addEventListener) {
  window.addEventListener("message", receiveMessage, false);
} else if (window.attachEvent) {
  window.attachEvent("onmessage", receiveMessage);
}

if (window.location.hash && window.location.hash.length > 1) {
  callParentFunction(window.location.hash.substring(1));
}
</script>
</head>
<body style="height:0px;margin:0px;padding:0px"></body>
</html>

IIS logs for successfully synchronized payment profiles look like this:

2017-07-11 13:19:44 10.5.52.7 GET /Frames/PaymentConnector.html - 443 *userid* 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://secure.authorize.net/profile/addPayment 200 0 0 68
2017-07-11 13:19:44 10.5.52.7 GET /notarealurl/1499779184371/"loaded$self" - 443 *userid* 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 50
2017-07-11 13:19:44 10.5.52.7 GET /notarealurl/1499779184371/"test$self" - 443 *userid* 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 52
2017-07-11 13:19:44 10.5.52.7 GET /notarealurl/1499779184371/"beforeProcessing:action=resizeWindow&width=435&height=463$self" - 443 - 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 50
2017-07-11 13:19:44 10.5.52.7 GET /notarealurl/1499779184371/"afterProcessing:action=resizeWindow&width=435&height=463$self" - 443 - 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 64 350
2017-07-11 13:21:17 10.5.52.7 GET /notarealurl/1499779184371/"action=successfulSave$https:/secure.authorize.net" - 443 - 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 48
2017-07-11 13:21:17 10.5.52.7 GET /notarealurl/1499779184371/"afterProcessing:action=successfulSave$self" - 443 - 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 48
2017-07-11 13:21:17 10.5.52.7 GET /notarealurl/1499779184371/"beforeProcessing:action=successfulSave$self" - 443 - 173.202.201.158 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://*customer_url*/Frames/PaymentConnector.html 302 0 0 49

But occasionally we get just this:

2017-07-11 14:14:20 10.5.52.7 GET /Frames/PaymentConnector.html - 443 *userid* 174.221.138.81 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+10_3_2+like+Mac+OS+X)+AppleWebKit/603.2.4+(KHTML,+like+Gecko)+Version/10.0+Mobile/14F89+Safari/602.1 https://secure.authorize.net/profile/addPayment 200 0 0 28

And no further references of any activity related to PaymentConnector.html for this user. But payment profile was created on authorize.net side for this user.

 

We cannot determine if communicator was loaded or not from our side, and hosted form does not indicate the situation when communicator failed to load either, so from end user’s perspective it may seem that everything is working fine, while it is not.

 

We were not able to reproduce this, but it keeps happening to our customers from time to time. 

 

Could you advise us on how to further diagnose the issue, or, possibly, suggest some workaround for it?

vdperov
Member
1 REPLY 1

Hello @vdperov


It's been a while since this was first posted. I would recommend subscribing to this topic so that you'll be alerted via email if anyone from the community is able to respond with any comments. To subscribe, click Topic Options at the top of this thread and then select Subscribe. You'll then receive an email once anyone replies.

Thanks,

Richard

RichardH
Administrator Administrator
Administrator