cancel
Showing results for 
Search instead for 
Did you mean: 

Not Getting Hosted Profile Page response event

I have a Laravel project webpage that includes a hosted payment form and a hosted profile form. Both are using iFrames and they both work in that they generate payments when submitting the payment form and create/remove payment profiles using the profile form. The problem is that I get a "transactResponse" event message from the Payment iFrame Communicator but the Profile iFrame Communicator only seems to give “resizeWindow” event messages. I have attempted to keep both sets of code as mirror images of each other with the only changes being in the settings passed to the token generator.

 

When the user requests the profile editor the following is loaded:

 

<div id="iframe_holder" class="center-block" data-mediator="methods-form-loader" style="max-width: 1000px">
    <iframe id="load_methods" class="embed-responsive-item" name="load_methods" scrolling="yes" width="595" height="500"
            frameborder="0">
    </iframe>

    <form id="send_hptoken" action="https://accept.authorize.net/customer/manage" method="post" target="load_methods">
        <input type="hidden" name="token"
               value="XFM+gaW2Sk1XzJr12C4xdhTe7Ot9oO4Qte78UEKuxl5NObhQ7AIjI3CZgtMwL9pK6SgJIs3x/XKzUV5xYenio8NUAd6Ca1aCjzMDnkfRBjXR767Jn89WPxvNa6z2mwjUT+aUNAIprb28/CYx8aWx1YhpjTgQNoHWgybH2zfIu8IL1k0G2T8gdRwf+1/CuxjwKya3PVISNTn+/yZyENngCfW6Drzb7hFkU32EyGIRw1RCZPee0buIuB2/Uu+Zo2SWShqcEmo/T71jkTuXC2WpVHZpZjn5Im/TjeZCAFH5HvKtXPb8Azx0+n3tyiEWYpd8X1Hk55ZJD0mfdSLOdvESIrK7c5FQhSVXniT9aLLneCij7uwVSju7uf/h0k698MgHUdniIJD0sRoWH2ZRHHXgR4H/809UEI4aG/KRGjY2JSHz+ZqLOcwcdQNQGfvM2OC2UJUlXb+nIMJqRqyokTw6TlprkYkoathiU+yHywzkI2lBzHf1tR5wXMwQ8NCl8/77dz0KII0WjJO7UqRNIKpNSPOE+gY05VLVHmIV3rzcKFeOD5/7F9lueLSu7H+rRC0JlAaVgdqvCHt9ET4RJk4SSX6TPkkaYskAyuRhKLQzgvXaxgRznC58qw8c0ezVFZ6yJFVbowO+woe1a0KFt9kDPU91neUHma/GMhQVA+WF0CJPuxW39GFRq0/qPqeh1g8LCbvW0/gGSJ2upTFJYpgcBZQ1cUcM8m5AB74Jq6BIXE1/e3yEheALkETJh6bUPvwO.43eyw4AmDuUM">
    </form>
</div>
<script>
    $(document).ready(function () {
        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) {
            console.log("onReceiveCommunication: " + JSON.stringify(argument));
            var params = parseQueryString(argument.qstr)

            // the following represent actions returned by authnet and should be applied to the page
            switch (params['action']) {
                case "resizeWindow"     :
                    break;

                case "successfulSave"   :
                    break;

                case "cancel"           :
                    break;

                case "transactResponse" :
                    sessionStorage.removeItem("HPTokenTime");
                    var transResponse = JSON.parse(params['response']);
                    console.log(transResponse);
                    break;
            }
        }

        //send the token
        $('#send_hptoken').submit();
    });
</script>

The list of settings used when creating the token are:

{
  "hostedProfilePageBorderVisible": "false",
  "hostedProfileIFrameCommunicatorUrl": "https:\/\/...\/billing\/MethodsIFrameCommunicator",
  "hostedProfileHeadingBgColor": "#00ff00",
  "hostedProfileBillingAddressRequired": "true",
  "hostedProfileCardCodeRequired": "true",
  "hostedProfileBillingAddressOptions": "showBillingAddress",
  "hostedProfileManageOptions": "showPayment",
  "hostedProfilePaymentOptions": "showAll",
  "hostedProfileValidationMode": "testMode"
}

Any help would be appreciated.

wdbaker54
Contributor
4 REPLIES 4

Since the profile does not do a transaction there is no transaction response from that one.  There is a success/failure indicator only, listen for successfulSave.

 

Hope this helps

brianmc
Administrator Administrator
Administrator

Thanks for the response but I did monitor the 'successfulSave' and it did not arrive - only a resizeWindow' event seems to be returned. I had removed my temporary console.log() debugging line for that event before posting the code - it never printed. I will remove the 'transactResponse' if my problem can be found.

We are experiencing the same issue.  For customer profile the only messages getting returned are the action "resizeWindow".   I am working on a proof of concept for a major change we want to make and this has me dead in the water that there is no acknowledgement for the successfulSave.

I am glad I am not alone in this. As a work-around, I have the iFrame embedded in a modal dialog and I capture the dialog's 'close' event and then query AuthNet for the profile and associated payment profiles and then update the local record with any changes found. Not elegant and I am sure I am eating some time to process but it does get me past the problem for the time being. I guess I need to work on using web hooks but for now I am under a time crunch.