cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

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
Who Me Too'd this topic