Reply
Member
Posts: 3
Registered: ‎01-27-2021

Help with iframe communications

We are using the hosted form solution for integration, and at first I had good luck with the iframe communication when a transaction was submitted, the example javascript code supplied on the authorize.net github account worked well, allowing us to respond to a completed transaction with our own code and update our database.  Now, we never see a finished transaction and I don't know why.  Here is our code.

(function () {
      window.CommunicationHandler = {};
      window.CommunicationHandler.onReceiveCommunication = function (querystr) {
        console.log('receive');
          var params = parseQueryString(querystr.qstr);
          console.log(params);
            switch (params["action"]) {
              case "successfulSave":
                break;
              case "cancel":
                break;
              case "resizeWindow":
                var w = parseInt(params["width"]);
                var h = parseInt(params["height"]);
                var ifrm = document.getElementById("add_payment");
                ifrm.style.width = w.toString() + "px";
                //ifrm.style.height = h.toString() + "px";
                break;
              case "transactResponse":
                var data = params['response'];
                $.post('receive.php?donation_id=<?php print $donation_id; ?>', data, function(response) {

                });
                var ifrm = document.getElementById("add_payment");
              }
          };

We never see the transactResponse action any more, only the resizeWindow action, and I have no idea why.  Anyone have any idea how to troubleshoot this?

Member
Posts: 3
Registered: ‎01-27-2021

Re: Help with iframe communications

As a follow up, I set the showReceipt to false when generating my form token and that has solved the general problem, I now see the transactReponse come through, but it does absolutely nothing for declined transactions, anyone know why declined wouldn't trigger this action in the iframe communications?

Member
Posts: 3
Registered: ‎01-27-2021

Re: Help with iframe communications

Sorry one more, with showReceipt set to false the Submit button gets stuck on Processing... even though the transaction goes through, anyone know about that?