cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with redirection from hosted form

Hi Team,

 

I are using Redirect module to capture payments, that is a token is generated by calling getHostedPaymentPageRequest, after receiving the token we do a form post to authorize.net/payment page, for authorize.net to capture the payment details. 

 

We are able to successfully implement the above process, however upon clicking on "Pay" on payments page it is redirecting to receipt page, which is not what we want. What we are looking for is as soon as he clicks on "Pay" after entering the credit card details, he should be redireceted back to our application to process the results and provide confirmation of the same. 

 

We went through the documentation of Authorize.net and as per that we tried using both hostedPaymentIFrameCommunicatorUrl and hostedPaymentReturnOptions, but with none we could acheive the desired result. 

 

One more thing which i wanted to mention here is that we are not using iframe, but instead doing a form post to authorize.net/payments to capture credit card details and return back data to our application. 

 

settingType[] settings = new settingType[4];

settings[0] = new settingType();
settings[0].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();
settings[0].settingValue = "{\"url\":\"http://test/test/Secure/AuthRelay.aspx?mode=post\"}";


settings[1] = new settingType();
settings[1].settingName =settingNameEnum.hostedPaymentBillingAddressOptions.ToString();
settings[1].settingValue = "{\"show\": false, \"required\": false}";


settings[2] = new settingType();
settings[2].settingName =settingNameEnum.hostedPaymentButtonOptions.ToString();
settings[2].settingValue = "{\"text\": \"Pay\"}";

settings[3] = new settingType();
settings[3].settingName =settingNameEnum.hostedPaymentReturnOptions.ToString();
settings[3].settingValue = "{\"showReceipt\" : false, \"url\":\"https://test/test/continue\",\"urlText\":\"Continue\",\"cancelUrl\":\"https://test/test/cancel\",\"cancelUrlText\":\"Cancel\"}";

 

Kindly advise if i was missing out anything, any help will be much appreciated. 

 

 

Sangu123
Member
6 REPLIES 6

Hi @Sangu123

 

For receipt page  not be shown  the hosted payment form needs to be embedded in the Iframe. 

 

https://developer.authorize.net/api/reference/features/accept_hosted.html#Displaying_the_Form 

 

 

 

When showReceipt is false, a return URL must be provided in the urlparameter. Otherwise the receipt page will be shown.

Important Note:

If the payment form is not embedded in an IFrame, the receipt page will be displayed and cannot be disabled, regardless of the value of showReceipt





Send feedback at developer_feedback@authorize.net
Anurag
Moderator Moderator
Moderator

Hi Anurag,

 

Thank you for the response, based on your recommendation above, it seems like we might have to use IFrameCommunicator to achieve the desired result, and so we have started implementation payment capture via IFrameCommunicator.

 

We have the following setting setup while generating the token:

 

 

settingType[] settings = new settingType[4];

settings[0] = new settingType();
settings[0].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();
settings[0].settingValue = "{\"url\":\"http://temp/temp/Secure/AuthRelay.aspx?mode=post\"}";


settings[1] = new settingType();
settings[1].settingName =settingNameEnum.hostedPaymentBillingAddressOptions.ToString();
settings[1].settingValue = "{\"show\": false, \"required\": false}";


settings[2] = new settingType();
settings[2].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();
settings[2].settingValue = "{\"text\": \"Pay\"}";

settings[3] = new settingType();
settings[3].settingName = settingNameEnum.hostedPaymentReturnOptions.ToString();
settings[3].settingValue = "{\"showReceipt\" : false, \"cancelUrl\":\"https://mysite.com/cancel\",\"cancelUrlText\":\"Cancel\"}";

 

We are able to successfully generate the token and enter payment details on Authorize.net page,  however upon clicking "Pay" button on Authorize.net page, we are getting a mail stating payment was received, but still it is not getting redirected to our page mentioned in the settings(the page where customer entered payment retained as is, and "Pay" button is replaced with "Processing" and seems to be freezed).

 

Could you please advise on what could be wrong and also please advise if you are aware of any Github source code example which has implemented IFrameCommunicator for .net technologies. 

 

 

Thanks in advance. 

The reason why it was happening so was because, onReceiveCommunication we are getting action value to be "resizeWindow" even after successful payment. Please let us know what configuration could be used to get action as "transactResponse" upon successful payment. 

Hi @Sangu123

 

You can check our Accept Sample app on github at 

 

https://github.com/AuthorizeNet/accept-sample-app/blob/master/README-AcceptHosted.md

 

Hope it helps !!! 





Send feedback at developer_feedback@authorize.net

Hello @Anurag,

 

We are facing issue related to this. We are able to get redirected on our site but not able to get the response from the Authorize.net. We are using C# asp.net. We were expecting to get the response either in the form of QueryString or in header. We are only getting ConnectionToken in response as form of header.

 

Please do let us know if you need more information.

 

Any help will be greately appericiated.

 

Thanks Yogesh

Hello @Anurag,

 

Please find more details below.

 

 

We are using Redirect module to capture payments, that is a token is generated by calling getHostedPaymentPageRequest, after receiving the token we do a form post to authorize.net/payment page, for authorize.net to capture the payment details.

We are able to successfully implement the above process, however upon clicking on "Pay" on payments page it is redirecting to receipt page, even if we set "showReceipt\": false for hostedPaymentReturnOptions settings.

Also, after clicking on ‘Continue to site’ button on receipt page, its successfully redirected to desired custom ‘AuthorizeNetReturn.aspx’ page of our application but we are unable to get or read receipt/transaction response data i.e. responseCode,AuthorizationCode and TransactionID on ‘AuthorizeNetReturn.aspx’ page

Below is the code

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

           ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()

           {

               name = loginID,

               ItemElementName = ItemChoiceType.transactionKey,

               Item = transactionKey,

           };

settingType[] settings = new settingType[7];

 

string returnURL = CommonHelper.GetStoreLocation(false) + "AuthorizeNetReturn.aspx";

settings[0] = new settingType();

settings[0].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();

settings[0].settingValue = "{\"text\": \"Pay\"}";

 

settings[1] = new settingType();

settings[1].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString(); settings[1].settingValue = "{\"show\": true}";

 

settings[2] = new settingType();

settings[2].settingName = settingNameEnum.hostedPaymentReturnOptions.ToString();

          

settings[2].settingValue = "{\"url\": \"" + returnURL + "\",\"urlText\":\"Continue to site\",\"cancelUrl\": \"" + returnURL+"\", \"showReceipt\": false}";

 

settings[3] = new settingType();

settings[3].settingName = settingNameEnum.hostedPaymentPaymentOptions.ToString();

settings[3].settingValue = "{\"cardCodeRequired\": true, \"showCreditCard\": true, \"showBankAccount\": false}";

 

settings[4] = new settingType();

settings[4].settingName = settingNameEnum.hostedPaymentBillingAddressOptions.ToString();

settings[4].settingValue = "{\"show\": false}";

 

settings[5] = new settingType();

settings[5].settingName = settingNameEnum.hostedPaymentShippingAddressOptions.ToString();

           settings[5].settingValue = "{\"show\": false}";

 

settings[6] = new settingType();

settings[6].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();

           settings[6].settingValue = "{\"url\": \"" + returnURL+"?mode=post" + "\"}";

 

var billTo = new customerAddressType

           {

               firstName = order.BillingFirstName,

               lastName = order.BillingLastName,

               address = order.BillingAddress1,

               city = order.BillingCity,

               state = order.BillingStateProvince,

               zip = order.BillingZipPostalCode,

               country=order.BillingCountry,

               phoneNumber=order.BillingPhoneNumber              

           };

 

var shipTo = new customerAddressType

           {

               firstName = order.ShippingFirstName,

               lastName = order.ShippingLastName,

               address = order.ShippingAddress1,

               city = order.ShippingCity,

               state = order.ShippingStateProvince,

               zip = order.ShippingZipPostalCode,

               country = order.ShippingCountry,

               phoneNumber = order.ShippingPhoneNumber

           };

var transactionRequest = new transactionRequestType

           {

               transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),  

               amount = Convert.ToDecimal(order.OrderTotal.ToString("####.00", new CultureInfo("en-US", false).NumberFormat)),

               billTo = billTo,

               shipTo=shipTo

              

           };

 

           var request = new getHostedPaymentPageRequest();

           request.transactionRequest = transactionRequest;

           request.hostedPaymentSettings = settings;

 

           // instantiate the controller that will call the service

           var controller = new getHostedPaymentPageController(request);

           controller.Execute();

 

           // get the response from the service (errors contained if any)

           var response = controller.GetApiResponse();

           if (response != null)

           {

               if (response.messages.resultCode == messageTypeEnum.Ok)

               {

                  

                   remotePostHelper.Add("token", response.token.ToString());

                  remotePostHelper.Post();

               }

       }

We went through the documentation of Authorize.net and as per that we tried using both hostedPaymentIFrameCommunicatorUrl and hostedPaymentReturnOptions, but with none we could acheive the desired result. 

 

One more thing which we wanted to mention here is that we are not using iframe, but instead doing a form post to authorize.net/payments to capture credit card details and return back data to our application. 

 

Kindly advise if we were missing out anything, any help will be much appreciated. 

 

Thanks in Advance,

Yogesh