cancel
Showing results for 
Search instead for 
Did you mean: 

CIM hosted form option - popup won't close on cancel or suscessful save

I'm using the brand new hosted option for CIM (with php) with is very nice.  It's working just fine for me... except one problem - the closePopup function in popup.js never gets called when I click cancel on the iframe form or have a successful save.  I've tried everything with no luck - I don't know if it's something I'm doing or something not firing on the hosted form page.  I'm not that great at javascript, but I tried debugging the script as it ran (profile.js) and it seemed to get to the part where it sends the 'cance' string to the iframecommunicator (which was valid), but then it seemed to get lost before triggering anything in popup.js.  If that makes any sense or you know what the problem is, please let me know!  I need to get this working. 

Thanks.  By the way, I'm using in a codeigniter framework, but I don't think that should have any effect on the issue, and everything besides the popup close is working fine.

 

jschomay
Member
1 ACCEPTED SOLUTION

Accepted Solutions

I believe I have the solution to this issue and am sharing my findings here for anyone else (like robdowns) who ran into this problem.

 

I worked quite a bit with the Authorize.net support engineers and this is what they suggested:

 

 

1)      The structure of the zip files being used need to exactly match the ones attached in the email. If they don't match, then some things may not work correctly.
2)      If the token of the page is no longer valid, then that could cause an issue.
3)      The domain of the url for IframeCommunicator.html has to exactly match the domain of the page that launches the popup.
4)      Check the server logs to make sure that the url for IframeCommunicator.html is getting hit.

 

 

While none of this helped me directly, point #4 made me realize that indeed my contentx/IframeCommunicator.html never got hit, which had to be the problem.  After poking around I looked at my code that makes the XML request called getHostedProfilePageRequest, specifically the url I set for the hostedProfileIFrameCommunicatorUrl setting.  I had originially set it to the page that calls the popup, which seems to be incorrect.  I tried changing it to the url directly to my contentx/IframeCommunicator.html... and now the pop up closes!  

 

So the issue was an incorrectly defined hostedProfileIFrameCommunicatorUrl in the XML call.  I'm not sure if my new setting is the correctly solution to the error or if it causes any other side effects, but it seems to be working just fine so far.  I want to note that the documentation for this is poorly lacking and very vague - the best I found was in the XML support guide on page 17.  I recommend the support team makes it more clear exactely where the url should point (also the spelling error is still present, so don't get confused by that).

 

SOLUTION RECAP: Make sure your value for the hostedProfileIFrameCommunicatorUrl setting in theXML getHostedProfilePageRequest points directly to the contentx/IframeCommunicator.html.  Hope that helps!

 

 

 

 

 

 

 

 

View solution in original post

13 REPLIES 13

Here's more info:

 

By debugging the javascript, I believe the problem to happen near line 872 of profile.js (from the hosted iframe).  The line says:

ifrm.contentWindow.postMessage(str, g_iframeCommunicatorUrl);

 

ifm seems to correclty identify the ifrmCommunicator element, the string is "action=cancel" and g_iframeCommunicatorUrl is set to the page iof my site that the iframe is on.

However, after that line, it doesn't seem to do anything.  I don't know what postMessage does, but on my popup.js script I can tell that the line that acceps the "action=cancel" passed string never gets called (which is why it doesn't hit the closePopup method).  

 

Any suggestions?  Is the problem with postMessage?  Should my iframeCommunicatorUrl be set to something different?  I can't think of anythign else.  Thank you.

jschomay
Member

I'd also like to see a solution to this. 

 

It is possible to add your own "Close" button outside the iFrame (but in the popup) using:

 

<a href="javascript&colon;;" onclick="AuthorizeNetPopup.closePopup();" title="Close"> </a>

 

But that doesn't solve the button issue...

robdowns
Member

I believe I have the solution to this issue and am sharing my findings here for anyone else (like robdowns) who ran into this problem.

 

I worked quite a bit with the Authorize.net support engineers and this is what they suggested:

 

 

1)      The structure of the zip files being used need to exactly match the ones attached in the email. If they don't match, then some things may not work correctly.
2)      If the token of the page is no longer valid, then that could cause an issue.
3)      The domain of the url for IframeCommunicator.html has to exactly match the domain of the page that launches the popup.
4)      Check the server logs to make sure that the url for IframeCommunicator.html is getting hit.

 

 

While none of this helped me directly, point #4 made me realize that indeed my contentx/IframeCommunicator.html never got hit, which had to be the problem.  After poking around I looked at my code that makes the XML request called getHostedProfilePageRequest, specifically the url I set for the hostedProfileIFrameCommunicatorUrl setting.  I had originially set it to the page that calls the popup, which seems to be incorrect.  I tried changing it to the url directly to my contentx/IframeCommunicator.html... and now the pop up closes!  

 

So the issue was an incorrectly defined hostedProfileIFrameCommunicatorUrl in the XML call.  I'm not sure if my new setting is the correctly solution to the error or if it causes any other side effects, but it seems to be working just fine so far.  I want to note that the documentation for this is poorly lacking and very vague - the best I found was in the XML support guide on page 17.  I recommend the support team makes it more clear exactely where the url should point (also the spelling error is still present, so don't get confused by that).

 

SOLUTION RECAP: Make sure your value for the hostedProfileIFrameCommunicatorUrl setting in theXML getHostedProfilePageRequest points directly to the contentx/IframeCommunicator.html.  Hope that helps!

 

 

 

 

 

 

 

 

Thanks for posting this!

 

I was able to get it working as well. My issue was the spelling error(!!!), but also realized I needed to test this outside our firewall...

 

Thanks again!

Yes, I had to pass the entire URL for that page - http:/domain.com/folder/contentx/IframeCommunicator.html - and then it closed appropriately. I don't know JS that well, but I would have thought it could do it on it's own..

Hi All,

 

At last i found a way to close the popup window. Please find below code. you have to set the proper SettingType. This step is mentioned in Page 59 of CIM_SOAP_guide.pdf.

 

 //Create empty CustomerProfile
 long profile_id = CreateCustomerProfile();
        if (profile_id <= 0) return;

 //set Input Parameters for GetHostedProfilePage
        CIMAPI.SettingType hps = new CIMAPI.SettingType();
        hps.settingName = "hostedProfileIFrameCommunicatorUrl";
        hps.settingValue = "http://localhost/IframeCommunicator.html";


        CIMAPI.SettingType hps1 = new CIMAPI.SettingType();
        hps1.settingName = "hostedProfilePageBorderVisible";
        hps1.settingValue = "false";
 

        CIMAPI.SettingType[] hpsarr = new CIMAPI.SettingType[] { hps, hps1 };


        CIMAPI.GetHostedProfilePageResponseType response = SoapAPIUtilities.Service.GetHostedProfilePage(SoapAPIUtilities.MerchantAuthentication, profile_id, hpsarr);
        Token.Value = response.token;

 

Once you created the TokenId you can see "Addpayment Method", "Edit Payment Method", "Add a New Shipping Addres", "Edit Shipping Address" in your aspx page. After you enter the CC info press save / cancel button to close the popup window.

 

If it is not closing the popup window after you apply the above code also. Please apply the following steps in your IE and check if it fixes the problem.


a. Open Internet Explorer.
b. Go to Tools -> Internet Options -> Security
c. Select the "Security" tab -> Click the "Custom Level" button
d. In the "Miscellaneous" section change “Display mixed content” to Enable.
e. Click on Ok.

 

For Reference: http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/i-can-not-disable-the-warning-only-secure-...

 

Thanks,

Sathish.

Thanks to Sathish and jschomay.


Using the info from both posts I have an asp.net sample app working!

 

By adding a contentx folder to the project and referencing the css/js files in it instead of copies I had scattered around my project, and by adding the SettingTypes to my SOAP call I am now getting the hosted iframe to close.

 

Thanks,

Ed

Hi Ed,

Would you be so kind and post some pointers or example code?

 

Thank you,

Robert

Hello,

Thanks a lot sathishbabu22 ... your Solution worked for me ...

 

 

Thanks & Regards,

Anu.