<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Authorized.net hosted form iframe unable to redirect to parent form in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Authorized-net-hosted-form-iframe-unable-to-redirect-to-parent/m-p/82010#M51696</link>
    <description>&lt;P&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="authorizedform.aspx.cs" Inherits="training2.Authorizednet.authorizedform" %&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent"&amp;gt;&lt;BR /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;BR /&gt;body {&lt;BR /&gt;margin: 0px;&lt;BR /&gt;padding: 0px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#divAuthorizeNetPopupScreen {&lt;BR /&gt;left: 0px;&lt;BR /&gt;top: 0px;&lt;BR /&gt;width: 100%;&lt;BR /&gt;height: 100%;&lt;BR /&gt;z-index: 1;&lt;BR /&gt;background-color: #808080;&lt;BR /&gt;opacity: 0.5;&lt;BR /&gt;-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';&lt;BR /&gt;filter: alpha(opacity=50);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#divAuthorizeNetPopup {&lt;BR /&gt;position: absolute;&lt;BR /&gt;left: 50%;&lt;BR /&gt;top: 50%;&lt;BR /&gt;margin-left: -200px;&lt;BR /&gt;margin-top: -200px;&lt;BR /&gt;z-index: 2;&lt;BR /&gt;overflow: visible;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupOuter {&lt;BR /&gt;background-color: #dddddd;&lt;BR /&gt;border-width: 1px;&lt;BR /&gt;border-style: solid;&lt;BR /&gt;border-color: #a0a0a0 #909090 #909090 #a0a0a0;&lt;BR /&gt;padding: 4px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupTop {&lt;BR /&gt;height: 23px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose {&lt;BR /&gt;position: absolute;&lt;BR /&gt;right: 7px;&lt;BR /&gt;top: 7px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a {&lt;BR /&gt;background-image: url('content/closeButton1.png');&lt;BR /&gt;background-repeat: no-repeat;&lt;BR /&gt;height: 16px;&lt;BR /&gt;width: 16px;&lt;BR /&gt;display: inline-block;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a:hover {&lt;BR /&gt;background-image: url('content/closeButton1h.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a:active {&lt;BR /&gt;background-image: url('content/closeButton1a.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupInner {&lt;BR /&gt;background-color: #ffffff;&lt;BR /&gt;border-width: 2px;&lt;BR /&gt;border-style: solid;&lt;BR /&gt;border-color: #cfcfcf #ebebeb #ebebeb #cfcfcf;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupBottom {&lt;BR /&gt;height: 30px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupLogo {&lt;BR /&gt;position: absolute;&lt;BR /&gt;right: 9px;&lt;BR /&gt;bottom: 4px;&lt;BR /&gt;width: 200px;&lt;BR /&gt;height: 25px;&lt;BR /&gt;background-image: url('content/powered_simple.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupSimpleTheme .AuthorizeNetPopupOuter {&lt;BR /&gt;border: 1px solid #585858;&lt;BR /&gt;background-color: #ffffff;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR /&gt;//&amp;lt;![CDATA[&lt;BR /&gt;function callParentFunction(str) {&lt;BR /&gt;if (str &amp;amp;&amp;amp; str.length &amp;gt; 0&lt;BR /&gt;&amp;amp;&amp;amp; window.parent&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent.AuthorizeNetPopup&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent.AuthorizeNetPopup.onReceiveCommunication) {&lt;BR /&gt;// Errors indicate a mismatch in domain between the page containing the iframe and this page.&lt;BR /&gt;window.parent.parent.AuthorizeNetPopup.onReceiveCommunication(str);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function receiveMessage(event) {&lt;BR /&gt;if (event &amp;amp;&amp;amp; event.data) {&lt;BR /&gt;callParentFunction(event.data);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (window.addEventListener) {&lt;BR /&gt;window.addEventListener("message", receiveMessage, false);&lt;BR /&gt;} else if (window.attachEvent) {&lt;BR /&gt;window.attachEvent("onmessage", receiveMessage);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (window.location.hash &amp;amp;&amp;amp; window.location.hash.length &amp;gt; 1) {&lt;BR /&gt;callParentFunction(window.location.hash.substring(1));&lt;BR /&gt;}&lt;BR /&gt;//]]/&amp;gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;!--Auth form--&amp;gt;&lt;BR /&gt;&amp;lt;div class="form-horizontal" style="padding-top: 50px;"&amp;gt;&lt;BR /&gt;Trigger Accept Transaction&lt;BR /&gt;&amp;lt;button id="btnOpenAuthorizeNetPopup" onclick="return AuthorizeNetPopup.openPopup()"&amp;gt;Open AuthorizeNetPopup&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="divAuthorizeNetPopup" style="display: none;" class="AuthorizeNetPopupGrayFrameTheme"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupOuter"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupTop"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupClose"&amp;gt;&lt;BR /&gt;&amp;lt;a href="javascript&amp;amp;colon;;" onclick="AuthorizeNetPopup.closePopup();" title="Close"&amp;gt;&amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupInner"&amp;gt;&lt;BR /&gt;&amp;lt;iframe name="iframeAuthorizeNet" id="iframeAuthorizeNet" src="../CarBooking/CarBookingForm" frameborder="0" scrolling="no"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupBottom"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupLogo" title="Powered by Authorize.net"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="divAuthorizeNetPopupScreen" style="display: none;"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;asp:HiddenField ID="token" ClientIDMode="Static" runat="server" Value="" /&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR /&gt;(function () {&lt;BR /&gt;if (!window.AuthorizeNetPopup) window.AuthorizeNetPopup = {};&lt;BR /&gt;if (!AuthorizeNetPopup.options) AuthorizeNetPopup.options = {&lt;BR /&gt;onPopupClosed: null&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;AuthorizeNetPopup.closePopup = function () {&lt;BR /&gt;document.getElementById("divAuthorizeNetPopupScreen").style.display = "none";&lt;BR /&gt;document.getElementById("divAuthorizeNetPopup").style.display = "none";&lt;BR /&gt;document.getElementById("iframeAuthorizeNet").src="../CarBooking/CarBookingForm";&lt;BR /&gt;document.getElementById("btnOpenAuthorizeNetPopup").disabled = false;&lt;BR /&gt;if (AuthorizeNetPopup.options.onPopupClosed) AuthorizeNetPopup.options.onPopupClosed();&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;AuthorizeNetPopup.openPopup = function () {&lt;BR /&gt;$("#token").prop('name', 'token');&lt;BR /&gt;///$('#myModal').modal('show');&lt;/P&gt;&lt;P&gt;setTimeout(function () {&lt;BR /&gt;var popup = document.getElementById("divAuthorizeNetPopup");&lt;BR /&gt;var popupScreen = document.getElementById("divAuthorizeNetPopupScreen");&lt;BR /&gt;var ifrm = document.getElementById("iframeAuthorizeNet");&lt;BR /&gt;var form = document.forms["form1"];&lt;/P&gt;&lt;P&gt;form.action = "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;";&lt;BR /&gt;form.target = "iframeAuthorizeNet"&lt;BR /&gt;ifrm.style.width = "400px";&lt;BR /&gt;ifrm.style.height = "400px";&lt;BR /&gt;form.submit();&lt;BR /&gt;// $("#form1").attr({ "action": "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;", "target": "iframeAuthorizeNet" }).submit();&lt;BR /&gt;/* $(window).scrollTop($('#add_payment').offset().top - 50);*/&lt;BR /&gt;popup.style.display = "";&lt;BR /&gt;popupScreen.style.display = "";&lt;BR /&gt;centerPopup();&lt;BR /&gt;//Add event EventListener&lt;/P&gt;&lt;P&gt;if (window.addEventListener) {&lt;BR /&gt;window.addEventListener("message", receiveMessage, false);&lt;BR /&gt;} else if (window.attachEvent) {&lt;BR /&gt;window.attachEvent("onmessage", receiveMessage);&lt;BR /&gt;}&lt;BR /&gt;$("#iframe_Id").contents("#button_id").click(functionToRun);&lt;BR /&gt;function functionToRun() {&lt;BR /&gt;alert("iframe clicked");&lt;BR /&gt;}&lt;BR /&gt;}, 200);&lt;BR /&gt;return false;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;AuthorizeNetPopup.onReceiveCommunication = function (querystr) {&lt;BR /&gt;var params = parseQueryString(querystr);&lt;BR /&gt;switch (params["action"]) {&lt;BR /&gt;case "successfulSave":&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "cancel":&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "transactResponse":&lt;BR /&gt;var response = params["response"];&lt;BR /&gt;document.getElementById("token").value = response;&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "resizeWindow":&lt;BR /&gt;var w = parseInt(params["width"]);&lt;BR /&gt;var h = parseInt(params["height"]);&lt;BR /&gt;var ifrm = document.getElementById("iframeAuthorizeNet");&lt;BR /&gt;ifrm.style.width = w.toString() + "px";&lt;BR /&gt;ifrm.style.height = h.toString() + "px";&lt;BR /&gt;centerPopup();&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;function centerPopup() {&lt;BR /&gt;var d = document.getElementById("divAuthorizeNetPopup");&lt;BR /&gt;d.style.left = "50%";&lt;BR /&gt;d.style.top = "50%";&lt;BR /&gt;var left = -Math.floor(d.clientWidth / 2);&lt;BR /&gt;var top = -Math.floor(d.clientHeight / 2);&lt;BR /&gt;d.style.marginLeft = left.toString() + "px";&lt;BR /&gt;d.style.marginTop = top.toString() + "px";&lt;BR /&gt;d.style.zIndex = "2";&lt;BR /&gt;if (d.offsetLeft &amp;lt; 16) {&lt;BR /&gt;d.style.left = "16px";&lt;BR /&gt;d.style.marginLeft = "0px";&lt;BR /&gt;}&lt;BR /&gt;if (d.offsetTop &amp;lt; 16) {&lt;BR /&gt;d.style.top = "16px";&lt;BR /&gt;d.style.marginTop = "0px";&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function parseQueryString(str) {&lt;BR /&gt;var vars = [];&lt;BR /&gt;var arr = str.split('&amp;amp;');&lt;BR /&gt;var pair;&lt;BR /&gt;for (var i = 0; i &amp;lt; arr.length; i++) {&lt;BR /&gt;pair = arr[i].split('=');&lt;BR /&gt;vars.push(pair[0]);&lt;BR /&gt;vars[pair[0]] = unescape(pair[1]);&lt;BR /&gt;}&lt;BR /&gt;return vars;&lt;BR /&gt;}&lt;BR /&gt;}());&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/asp:Content&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private void GetToken()&lt;BR /&gt;{&lt;BR /&gt;string ApiId = "23WdzW6F";&lt;BR /&gt;string ApiTransactionKey = "8s2SLbk5ur9SN52N";&lt;BR /&gt;decimal amount = 20M;&lt;BR /&gt;lineItemType[] lineItemTypes = new lineItemType[1];&lt;BR /&gt;lineItemType lineItem = new lineItemType()&lt;BR /&gt;{&lt;BR /&gt;itemId = "1234",&lt;BR /&gt;name = "Test",&lt;BR /&gt;description = "Test",&lt;BR /&gt;quantity = 1,&lt;BR /&gt;unitPrice = 20,&lt;BR /&gt;taxable = true,&lt;BR /&gt;};&lt;BR /&gt;lineItemTypes.SetValue(lineItem, 0);&lt;BR /&gt;customerAddressType billTo = new customerAddressType()&lt;BR /&gt;{&lt;BR /&gt;firstName = "Ellen",&lt;BR /&gt;lastName = "Johnson",&lt;BR /&gt;company = "Souveniropolis",&lt;BR /&gt;address = "14 Main Street",&lt;BR /&gt;city = "Pecan Springs",&lt;BR /&gt;state = "TX",&lt;BR /&gt;zip = "44628"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var res = AuthorizeNet.AcceptSuite.ExecuteMethod(ApiId,&lt;BR /&gt;ApiTransactionKey,&lt;BR /&gt;amount, false, false, @"&lt;A href="https://localhost:44391/CarBooking/CarBookingForm" target="_blank"&gt;https://localhost:44391/CarBooking/CarBookingForm&lt;/A&gt;",&lt;BR /&gt;@"&lt;A href="https://localhost:44391/" target="_blank"&gt;https://localhost:44391/&lt;/A&gt;", lineItemTypes, billTo);&lt;BR /&gt;token.Value = ((AuthorizeNet.Api.Contracts.V1.getHostedPaymentPageResponse)res).token;&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 06:46:01 GMT</pubDate>
    <dc:creator>venubabu12</dc:creator>
    <dc:date>2022-04-05T06:46:01Z</dc:date>
    <item>
      <title>Authorized.net hosted form iframe unable to redirect to parent form</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Authorized-net-hosted-form-iframe-unable-to-redirect-to-parent/m-p/82010#M51696</link>
      <description>&lt;P&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="authorizedform.aspx.cs" Inherits="training2.Authorizednet.authorizedform" %&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent"&amp;gt;&lt;BR /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;BR /&gt;body {&lt;BR /&gt;margin: 0px;&lt;BR /&gt;padding: 0px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#divAuthorizeNetPopupScreen {&lt;BR /&gt;left: 0px;&lt;BR /&gt;top: 0px;&lt;BR /&gt;width: 100%;&lt;BR /&gt;height: 100%;&lt;BR /&gt;z-index: 1;&lt;BR /&gt;background-color: #808080;&lt;BR /&gt;opacity: 0.5;&lt;BR /&gt;-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';&lt;BR /&gt;filter: alpha(opacity=50);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#divAuthorizeNetPopup {&lt;BR /&gt;position: absolute;&lt;BR /&gt;left: 50%;&lt;BR /&gt;top: 50%;&lt;BR /&gt;margin-left: -200px;&lt;BR /&gt;margin-top: -200px;&lt;BR /&gt;z-index: 2;&lt;BR /&gt;overflow: visible;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupOuter {&lt;BR /&gt;background-color: #dddddd;&lt;BR /&gt;border-width: 1px;&lt;BR /&gt;border-style: solid;&lt;BR /&gt;border-color: #a0a0a0 #909090 #909090 #a0a0a0;&lt;BR /&gt;padding: 4px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupTop {&lt;BR /&gt;height: 23px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose {&lt;BR /&gt;position: absolute;&lt;BR /&gt;right: 7px;&lt;BR /&gt;top: 7px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a {&lt;BR /&gt;background-image: url('content/closeButton1.png');&lt;BR /&gt;background-repeat: no-repeat;&lt;BR /&gt;height: 16px;&lt;BR /&gt;width: 16px;&lt;BR /&gt;display: inline-block;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a:hover {&lt;BR /&gt;background-image: url('content/closeButton1h.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupClose a:active {&lt;BR /&gt;background-image: url('content/closeButton1a.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupInner {&lt;BR /&gt;background-color: #ffffff;&lt;BR /&gt;border-width: 2px;&lt;BR /&gt;border-style: solid;&lt;BR /&gt;border-color: #cfcfcf #ebebeb #ebebeb #cfcfcf;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupBottom {&lt;BR /&gt;height: 30px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupGrayFrameTheme .AuthorizeNetPopupLogo {&lt;BR /&gt;position: absolute;&lt;BR /&gt;right: 9px;&lt;BR /&gt;bottom: 4px;&lt;BR /&gt;width: 200px;&lt;BR /&gt;height: 25px;&lt;BR /&gt;background-image: url('content/powered_simple.png');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.AuthorizeNetPopupSimpleTheme .AuthorizeNetPopupOuter {&lt;BR /&gt;border: 1px solid #585858;&lt;BR /&gt;background-color: #ffffff;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR /&gt;//&amp;lt;![CDATA[&lt;BR /&gt;function callParentFunction(str) {&lt;BR /&gt;if (str &amp;amp;&amp;amp; str.length &amp;gt; 0&lt;BR /&gt;&amp;amp;&amp;amp; window.parent&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent.AuthorizeNetPopup&lt;BR /&gt;&amp;amp;&amp;amp; window.parent.parent.AuthorizeNetPopup.onReceiveCommunication) {&lt;BR /&gt;// Errors indicate a mismatch in domain between the page containing the iframe and this page.&lt;BR /&gt;window.parent.parent.AuthorizeNetPopup.onReceiveCommunication(str);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function receiveMessage(event) {&lt;BR /&gt;if (event &amp;amp;&amp;amp; event.data) {&lt;BR /&gt;callParentFunction(event.data);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (window.addEventListener) {&lt;BR /&gt;window.addEventListener("message", receiveMessage, false);&lt;BR /&gt;} else if (window.attachEvent) {&lt;BR /&gt;window.attachEvent("onmessage", receiveMessage);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (window.location.hash &amp;amp;&amp;amp; window.location.hash.length &amp;gt; 1) {&lt;BR /&gt;callParentFunction(window.location.hash.substring(1));&lt;BR /&gt;}&lt;BR /&gt;//]]/&amp;gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;!--Auth form--&amp;gt;&lt;BR /&gt;&amp;lt;div class="form-horizontal" style="padding-top: 50px;"&amp;gt;&lt;BR /&gt;Trigger Accept Transaction&lt;BR /&gt;&amp;lt;button id="btnOpenAuthorizeNetPopup" onclick="return AuthorizeNetPopup.openPopup()"&amp;gt;Open AuthorizeNetPopup&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="divAuthorizeNetPopup" style="display: none;" class="AuthorizeNetPopupGrayFrameTheme"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupOuter"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupTop"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupClose"&amp;gt;&lt;BR /&gt;&amp;lt;a href="javascript&amp;amp;colon;;" onclick="AuthorizeNetPopup.closePopup();" title="Close"&amp;gt;&amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupInner"&amp;gt;&lt;BR /&gt;&amp;lt;iframe name="iframeAuthorizeNet" id="iframeAuthorizeNet" src="../CarBooking/CarBookingForm" frameborder="0" scrolling="no"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupBottom"&amp;gt;&lt;BR /&gt;&amp;lt;div class="AuthorizeNetPopupLogo" title="Powered by Authorize.net"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="divAuthorizeNetPopupScreen" style="display: none;"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;asp:HiddenField ID="token" ClientIDMode="Static" runat="server" Value="" /&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR /&gt;(function () {&lt;BR /&gt;if (!window.AuthorizeNetPopup) window.AuthorizeNetPopup = {};&lt;BR /&gt;if (!AuthorizeNetPopup.options) AuthorizeNetPopup.options = {&lt;BR /&gt;onPopupClosed: null&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;AuthorizeNetPopup.closePopup = function () {&lt;BR /&gt;document.getElementById("divAuthorizeNetPopupScreen").style.display = "none";&lt;BR /&gt;document.getElementById("divAuthorizeNetPopup").style.display = "none";&lt;BR /&gt;document.getElementById("iframeAuthorizeNet").src="../CarBooking/CarBookingForm";&lt;BR /&gt;document.getElementById("btnOpenAuthorizeNetPopup").disabled = false;&lt;BR /&gt;if (AuthorizeNetPopup.options.onPopupClosed) AuthorizeNetPopup.options.onPopupClosed();&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;AuthorizeNetPopup.openPopup = function () {&lt;BR /&gt;$("#token").prop('name', 'token');&lt;BR /&gt;///$('#myModal').modal('show');&lt;/P&gt;&lt;P&gt;setTimeout(function () {&lt;BR /&gt;var popup = document.getElementById("divAuthorizeNetPopup");&lt;BR /&gt;var popupScreen = document.getElementById("divAuthorizeNetPopupScreen");&lt;BR /&gt;var ifrm = document.getElementById("iframeAuthorizeNet");&lt;BR /&gt;var form = document.forms["form1"];&lt;/P&gt;&lt;P&gt;form.action = "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;";&lt;BR /&gt;form.target = "iframeAuthorizeNet"&lt;BR /&gt;ifrm.style.width = "400px";&lt;BR /&gt;ifrm.style.height = "400px";&lt;BR /&gt;form.submit();&lt;BR /&gt;// $("#form1").attr({ "action": "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;", "target": "iframeAuthorizeNet" }).submit();&lt;BR /&gt;/* $(window).scrollTop($('#add_payment').offset().top - 50);*/&lt;BR /&gt;popup.style.display = "";&lt;BR /&gt;popupScreen.style.display = "";&lt;BR /&gt;centerPopup();&lt;BR /&gt;//Add event EventListener&lt;/P&gt;&lt;P&gt;if (window.addEventListener) {&lt;BR /&gt;window.addEventListener("message", receiveMessage, false);&lt;BR /&gt;} else if (window.attachEvent) {&lt;BR /&gt;window.attachEvent("onmessage", receiveMessage);&lt;BR /&gt;}&lt;BR /&gt;$("#iframe_Id").contents("#button_id").click(functionToRun);&lt;BR /&gt;function functionToRun() {&lt;BR /&gt;alert("iframe clicked");&lt;BR /&gt;}&lt;BR /&gt;}, 200);&lt;BR /&gt;return false;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;AuthorizeNetPopup.onReceiveCommunication = function (querystr) {&lt;BR /&gt;var params = parseQueryString(querystr);&lt;BR /&gt;switch (params["action"]) {&lt;BR /&gt;case "successfulSave":&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "cancel":&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "transactResponse":&lt;BR /&gt;var response = params["response"];&lt;BR /&gt;document.getElementById("token").value = response;&lt;BR /&gt;AuthorizeNetPopup.closePopup();&lt;BR /&gt;break;&lt;BR /&gt;case "resizeWindow":&lt;BR /&gt;var w = parseInt(params["width"]);&lt;BR /&gt;var h = parseInt(params["height"]);&lt;BR /&gt;var ifrm = document.getElementById("iframeAuthorizeNet");&lt;BR /&gt;ifrm.style.width = w.toString() + "px";&lt;BR /&gt;ifrm.style.height = h.toString() + "px";&lt;BR /&gt;centerPopup();&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;function centerPopup() {&lt;BR /&gt;var d = document.getElementById("divAuthorizeNetPopup");&lt;BR /&gt;d.style.left = "50%";&lt;BR /&gt;d.style.top = "50%";&lt;BR /&gt;var left = -Math.floor(d.clientWidth / 2);&lt;BR /&gt;var top = -Math.floor(d.clientHeight / 2);&lt;BR /&gt;d.style.marginLeft = left.toString() + "px";&lt;BR /&gt;d.style.marginTop = top.toString() + "px";&lt;BR /&gt;d.style.zIndex = "2";&lt;BR /&gt;if (d.offsetLeft &amp;lt; 16) {&lt;BR /&gt;d.style.left = "16px";&lt;BR /&gt;d.style.marginLeft = "0px";&lt;BR /&gt;}&lt;BR /&gt;if (d.offsetTop &amp;lt; 16) {&lt;BR /&gt;d.style.top = "16px";&lt;BR /&gt;d.style.marginTop = "0px";&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function parseQueryString(str) {&lt;BR /&gt;var vars = [];&lt;BR /&gt;var arr = str.split('&amp;amp;');&lt;BR /&gt;var pair;&lt;BR /&gt;for (var i = 0; i &amp;lt; arr.length; i++) {&lt;BR /&gt;pair = arr[i].split('=');&lt;BR /&gt;vars.push(pair[0]);&lt;BR /&gt;vars[pair[0]] = unescape(pair[1]);&lt;BR /&gt;}&lt;BR /&gt;return vars;&lt;BR /&gt;}&lt;BR /&gt;}());&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/asp:Content&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private void GetToken()&lt;BR /&gt;{&lt;BR /&gt;string ApiId = "23WdzW6F";&lt;BR /&gt;string ApiTransactionKey = "8s2SLbk5ur9SN52N";&lt;BR /&gt;decimal amount = 20M;&lt;BR /&gt;lineItemType[] lineItemTypes = new lineItemType[1];&lt;BR /&gt;lineItemType lineItem = new lineItemType()&lt;BR /&gt;{&lt;BR /&gt;itemId = "1234",&lt;BR /&gt;name = "Test",&lt;BR /&gt;description = "Test",&lt;BR /&gt;quantity = 1,&lt;BR /&gt;unitPrice = 20,&lt;BR /&gt;taxable = true,&lt;BR /&gt;};&lt;BR /&gt;lineItemTypes.SetValue(lineItem, 0);&lt;BR /&gt;customerAddressType billTo = new customerAddressType()&lt;BR /&gt;{&lt;BR /&gt;firstName = "Ellen",&lt;BR /&gt;lastName = "Johnson",&lt;BR /&gt;company = "Souveniropolis",&lt;BR /&gt;address = "14 Main Street",&lt;BR /&gt;city = "Pecan Springs",&lt;BR /&gt;state = "TX",&lt;BR /&gt;zip = "44628"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var res = AuthorizeNet.AcceptSuite.ExecuteMethod(ApiId,&lt;BR /&gt;ApiTransactionKey,&lt;BR /&gt;amount, false, false, @"&lt;A href="https://localhost:44391/CarBooking/CarBookingForm" target="_blank"&gt;https://localhost:44391/CarBooking/CarBookingForm&lt;/A&gt;",&lt;BR /&gt;@"&lt;A href="https://localhost:44391/" target="_blank"&gt;https://localhost:44391/&lt;/A&gt;", lineItemTypes, billTo);&lt;BR /&gt;token.Value = ((AuthorizeNet.Api.Contracts.V1.getHostedPaymentPageResponse)res).token;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 06:46:01 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Authorized-net-hosted-form-iframe-unable-to-redirect-to-parent/m-p/82010#M51696</guid>
      <dc:creator>venubabu12</dc:creator>
      <dc:date>2022-04-05T06:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Authorized.net hosted form iframe unable to redirect to parent form</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Authorized-net-hosted-form-iframe-unable-to-redirect-to-parent/m-p/82056#M51729</link>
      <description>&lt;P&gt;&lt;U&gt;Using our sandbox authorize.net account, the iframe hosted checkout page shows up. I can fill out the credit card info and submit. I get the receipt, 2 receipt emails from authorize.net and get sent to the confirmation page, but the case "transactResponse" in AuthorizeNetIFrame.onReceiveCommunication never gets triggered. I put a alert in the javascript function to see all the querystrings that come into the iframe.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Other than the coldfusion code to authenticate and get the token (which seems to work) I got the rest of the code from the Authorize.net documentation.&amp;nbsp;&lt;A href="https://www.subarunet.me/" target="_self"&gt;&lt;FONT color="#000000"&gt;Subarunet.com&lt;/FONT&gt;&lt;/A&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Any idea why I don't see the action=transactResponse query string come into iframe with the response from the authorize.net credit card transaction.&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 04:34:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Authorized-net-hosted-form-iframe-unable-to-redirect-to-parent/m-p/82056#M51729</guid>
      <dc:creator>Rodriguez999</dc:creator>
      <dc:date>2022-04-07T04:34:31Z</dc:date>
    </item>
  </channel>
</rss>

