Reply
Highlighted
Contributor
Posts: 13
Registered: ‎10-21-2013

Re: Unable to read Relay Response POST Data in ASP.NET

Hi,

I have tried the following solution as specified in forum,Still am not able to redirect to my website pageusing relay url.I have set the enableviewstateMAC=false in all pages.here is my code.Please let me know where am doing the mistake.

 

my code behind

btnSubmit.PostBackUrl = "https://test.authorize.net/gateway/transact.dll";

strAuthorizeNet_x_amount = row["Amount"].ToString();
strAuthorizeNet_x_login = "************";
strAuthorizeNet_x_first_name = userRow["FirstName"].ToString();
strAuthorizeNet_x_last_name = userRow["LastName"].ToString();
strAuthorizeNet_x_address = userRow["Address1"].ToString();
strAuthorizeNet_x_city = userRow["City"].ToString();
strAuthorizeNet_x_state = userRow["State"].ToString();
strAuthorizeNet_x_zip = userRow["PostalCode"].ToString();
strAuthorizeNet_x_relay_url = "http://localhost:54269/WebForm2.aspx";
Random random = new Random();
strAuthorizeNet_x_fp_timestamp = ((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds).ToString();
strAuthorizeNet_x_fp_sequence = (random.Next(0, 1000)).ToString();
strAuthorizeNet_x_relay_response = "TRUE";
strAuthorizeNet_x_test_request = "TRUE";
strAuthorizeNet_x_fp_hash = HMAC_MD5("***************", strAuthorizeNet_x_login + "^" + strAuthorizeNet_x_fp_sequence + "^" + strAuthorizeNet_x_fp_timestamp + "^" + decimal.Parse(strAuthorizeNet_x_amount) + "^");

 

 

Whenever i submit the form with the post data am getting the following error

 

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

      This transaction cannot be accepted. 

Please help me out to solve this issue.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Unable to read Relay Response POST Data in ASP.NET

Problem is your relay response URL

From

http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Relay-Response-Basics-a...

If the merchant’s Web server is not available on the public Internet, has authentication enabled, or if the Relay URL uses a non-standard port for HTTP or HTTPS traffic, Relay Response timeouts will occur. Authorize.Net will not have any means to connect to your server or authenticate itself on your server, and can only use ports 80 and 443 for all Web traffic

Contributor
Posts: 13
Registered: ‎10-21-2013

Re: Unable to read Relay Response POST Data in ASP.NET

Hi,

 

As suggested we have hosted the project in webserver and we are able to redirect the page as configured in relay response url.Please help me out how to receive the relay response for the request in C#.Based on the response we need to redirect to the URL.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Unable to read Relay Response POST Data in ASP.NET

Contributor
Posts: 13
Registered: ‎10-21-2013

Re: Unable to read Relay Response POST Data in ASP.NET

Hi ,
My requirement is once the payment is done the site should be redirected to update the transaction in databased based on the response , If this can be achieved by relay url, plz provide the sample.If not plz provide the sample to receive the response of the payment , based on the response updation has to be triggered in the database

btnSubmit.PostBackUrl = "https://test.authorize.net/gateway/transact.dll";
strAuthorizeNet_x_amount = row["Amount"].ToString();
strAuthorizeNet_x_login = "************";
strAuthorizeNet_x_first_name = userRow["FirstName"].ToString();
strAuthorizeNet_x_last_name = userRow["LastName"].ToString();
strAuthorizeNet_x_address = userRow["Address1"].ToString();
strAuthorizeNet_x_city = userRow["City"].ToString();
strAuthorizeNet_x_state = userRow["State"].ToString();
strAuthorizeNet_x_zip = userRow["PostalCode"].ToString();
strAuthorizeNet_x_relay_url = "http://localhost:54269/WebForm2.aspx";
Random random = new Random();
strAuthorizeNet_x_fp_timestamp = ((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds).ToString();
strAuthorizeNet_x_fp_sequence = (random.Next(0, 1000)).ToString();
strAuthorizeNet_x_relay_response = "TRUE";
strAuthorizeNet_x_test_request = "TRUE";
strAuthorizeNet_x_fp_hash = HMAC_MD5("***************", strAuthorizeNet_x_login + "^" + strAuthorizeNet_x_fp_sequence + "^" + strAuthorizeNet_x_fp_timestamp + "^" + decimal.Parse(strAuthorizeNet_x_amount) + "^");


Am not sure whether am following the correct mechanism.Please help me out to solve this issue.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Unable to read Relay Response POST Data in ASP.NET

Yes, you can use relay response url page to first update the database that do a javascript redirect.

authorize.net didn't have any sample code but you modify the example post here

http://community.developer.authorize.net/t5/Integration-and-Testing/Unable-to-read-Relay-Response-PO...

Contributor
Posts: 13
Registered: ‎10-21-2013

Re: Unable to read Relay Response POST Data in ASP.NET

Hi ,

 

I have integrated the payment response codein my application and configured the receipt /Relay URL in my settings test mode.But am getting the error as 

"Response Code 3 TEST MODE The referrer relay response or receipt link URL is invalid authorize net".

 

My URL Is:http://www...............com/testpayment/thanks.aspx

 

Please let me know  where am i doing wrong.

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Unable to read Relay Response POST Data in ASP.NET

You need to set the relay response URL in the merchant account. Login to the account and it under settings.

Contributor
Posts: 13
Registered: ‎10-21-2013

Re: Unable to read Relay Response POST Data in ASP.NET

I configured the same under settings but still I am facing the error.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Unable to read Relay Response POST Data in ASP.NET

http://developer.authorize.net/tools/responsereasoncode/

put in 14

 

you must be sending something different. are you hardcode the url or a variable? do you only have 1 account or multiple?