cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Advice for developers using getHostedPaymentPageRequest, with an Embedded IFrame Communicator

I read every previous post on IFrame Communicator, read the documentation, but had to use the DEVELOPER TOOLS, debugging features of CHROME, and also very importantly a "posted messaging monitor" that would show the line code execution when the posted payment result was returned in the IFrameCommunicator form. This allowed me to trace the javascript to see what was broken and quickly fix it.

From previous posts and my experience, Auhorize Net seems to change some things that impact how the posted code works, without updating their posted code.

This line of code in the IFrameCommunicator receives the call-back response from AuthorizeNet:

callParentFunction(window.location.hash.substring(1));

Because I copied the IFrameCommunicator page from the GitHub app, it did not match the Container form javascript objects published on the website, Authorize Net Accept Hosted Documentation , some elements were named differently. In the IFrameCommunicator the ContainerForm parent elements must all be defined, named the same as how they are referenced in the IFrameCommunicator:

(... window.parent && window.parent.parent 
     && window.parent.parent.AuthorizeNetIFrame  && window.parent.parent.AuthorizeNetIFrame.onReceiveCommunication)

Here in the IFrameCommunicator, Authorize Net changed the type passed to the ContainerForm from string to object:

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

So in the ContainerForm, in the 

function parseQueryString(str) {
	var vars = [];
	var arr = str.qstr.split('&');  <<<--- add dot notation referencing the .qstr property

Also, make sure that you have enabled cross iframe communication with the use of a cookie in the response header of your IFrameCommunicator form:

'Set-Cookie'; 'CROSS_SITE_PERMISSION=YES; Path=/; HttpOnly; SameSite=None; Secure'

The cookie name above is arbitrary.

These were the Authorize Net hurdles I have encountered so far.

Example body for requesting the TOKEN:

$HTTP_Request_Body_ob:=New object("getHostedPaymentPageRequest"; \
New object(\
"merchantAuthentication"; New object("name"; Merchant_Name_t; "transactionKey"; Merchant_Key_t); \
"transactionRequest"; New object("transactionType"; "authCaptureTransaction"; "amount"; String([Payment]Amount); \
"profile"; New object("customerProfileId"; String([Payment]AccountNo)); \
"billTo"; New object(\
"firstName"; [Account]Bill_To_First_Name; \
"lastName"; [Account]Bill_To_Last_Name; \
"address"; [Account]Bill_To_Address; \
"city"; [Account]Bill_To_City; \
"state"; [Account]Bill_To_State; \
"zip"; [Account]Bill_To_Zip; \
"country"; "US")); \
"hostedPaymentSettings"; \
New object("setting"; New collection(\
New object("settingName"; "hostedPaymentReturnOptions"; "settingValue"; "{\"showReceipt\": false, \"url\": \"https://"+$SubDomain_t+"/"+$Iteration_Remote_Path_t+"/AN_HostedPaymentForm_Receipt.a4d\"}"); \
New object("settingName"; "hostedPaymentButtonOptions"; "settingValue"; "{\"text\": \"Enter Payment Info\"}"); \
New object("settingName"; "hostedPaymentStyleOptions"; "settingValue"; "{\"bgColor\": \"blue\"}"); \
New object("settingName"; "hostedPaymentPaymentOptions"; "settingValue"; "{\"cardCodeRequired\": false, \"showCreditCard\": true, \"showBankAccount\": true}"); \
New object("settingName"; "hostedPaymentSecurityOptions"; "settingValue"; "{\"captcha\": false}"); \
New object("settingName"; "hostedPaymentShippingAddressOptions"; "settingValue"; "{\"show\": false, \"required\": false}"); \
New object("settingName"; "hostedPaymentBillingAddressOptions"; "settingValue"; "{\"show\": true, \"required\": false}"); \
New object("settingName"; "hostedPaymentCustomerOptions"; "settingValue"; "{\"showEmail\": false, \"requiredEmail\": false, \"addPaymentProfile\": true}"); \
New object("settingName"; "hostedPaymentOrderOptions"; "settingValue"; "{\"show\": false}"); \
New object("settingName"; "hostedPaymentIFrameCommunicatorUrl"; "settingValue"; "{\"url\": \"https://"+$SubDomain_t+"/"+$Iteration_Remote_Path_t+"/AN_HostedPaymentForm_IFrameCommunicator.a4d\"}")\
))))
marine2026
Trusted Contributor
3 REPLIES 3

Hello,

 

As per your post i beliveing in this post i got same query so i really search every ware but no result found finnaly i am came here to solve my query.. I hope some one can help us.

 

 

harrnhy1
Member

My post describes how to solve the bug.

If you have not yet solved it, please start a new post, and I'll try to help you.

Thanks!!

marine2026
Trusted Contributor

got it. I am clear now

spectra
Member