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.
Solved! Go to Solution.
05-25-2011 06:55 PM
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:
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!
06-01-2011 08:50 PM
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.
05-26-2011 04:53 PM
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:;" onclick="AuthorizeNetPopup.closePopup();" title="Close"> </a>
But that doesn't solve the button issue...
05-31-2011 09:47 PM - edited 05-31-2011 09:49 PM
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:
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!
06-01-2011 08:50 PM
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!
06-02-2011 10:50 AM
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..
09-05-2011 12:58 PM
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.
11-17-2011 02:12 AM
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
03-08-2012 08:47 PM
Hi Ed,
Would you be so kind and post some pointers or example code?
Thank you,
Robert
06-10-2012 02:03 AM
Hello,
Thanks a lot sathishbabu22 ... your Solution worked for me ...
Thanks & Regards,
Anu.
09-06-2012 02:40 AM