cancel
Showing results for 
Search instead for 
Did you mean: 

Accept hosted form response

I successfully implement your Accep Hosted example in Model box.

when i click on pay button  always,my transaction response, as it returns empty

 

action=transactResponse&response={

 

i have added IFrameCommunicator.html ur in hostedPaymentIFrameCommunicatorUrl

but i can't track my issue ..

 

reposne from  test.authorize.net/payment/Api.ashx

{"resultCode":"Ok","messageCode":"Ok","transactionData":{"accountType":"Visa","accountNumber":"XXXX0130"
,"transId":"60101095995","responseCode":"1","authorization":"V3DWUE","billTo":{"firstName":"Ellen","lastName"
:"Johnson","company":"Souveniropolis","address":"14 Main Street","city":"Pecan Springs","state":"TX"
,"zip":"44628","country":"USA"},"totalAmount":"2.00","dateTime":"3/28/2018 9:31:21 AM"}}

 

IFrameCommunicator Code 

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IFrame Communicator</title>

<!--
To securely communicate between our Accept Hosted form and your web page,
we need a communicator page which will be hosted on your site alongside
your checkout/payment page. You can provide the URL of the communicator
page in your token request, which will allow Authorize.Net to embed the
communicator page in the payment form, and send JavaScript messaging through
your communicator page to a listener script on your main page.

This page contains a JavaScript that listens for events from the payment
form and passes them to an event listener in the main page.
-->


<script type="text/javascript">

function callParentFunction(str) {
if (str && str.length > 0 && window.parent && window.parent.parent
&& window.parent.parent.CommunicationHandler && window.parent.parent.CommunicationHandler.onReceiveCommunication)
{
var referrer = document.referrer;

window.parent.parent.CommunicationHandler.onReceiveCommunication({qstr : str , parent : referrer});
}
}

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) {
alert(window.location.hash);
callParentFunction(window.location.hash.substring(1));
}

</script>
</head>
<body>
</body>
</html>

 

 

Any help appreciated,

thank you.

 

 

 

 

ioiki
Member
1 REPLY 1

I have the same issue.  How do we get the data to the requesting js?  I get a response but not in the page calling the iframe.

Stellar2019
Member