cancel
Showing results for 
Search instead for 
Did you mean: 

Need Serious Help...

So, I have inherited a site that uses Authorize.Net, and I'm trying to figure out why my transactions are erroring.  Using a real credit card pointed to my Sandbox account, I'm getting the following error message:

 

Code = 3
Auth =
Message = The referrer, relay response or receipt link URL is invalid.
TransID = 0
Approved = False

 

This particular text is being returned from AuthorizeNet.SIMResponse(post).  post is the FormCollection passed to the Controller.  My relay URL is pointing to my site "\Search\SimResponse."  The code in that message points to a decline on the card, but that's not what the message says and I don't know what to do about it.  Please help!

HillChris7714
Member
4 REPLIES 4

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

 

The error basically said the url is not setup on your sandbox account, login to the accounts, under settings, there valid relay response url. Add your url to it. And you can't use relative path, need to be an absolute path.

RaynorC1emen7
Expert

So, I actually do have a valid relay url set up.  It's an absolute URL that points back to my website, and I know my site is picking up on it because it's performing the Error Trapping I have set up.  What I'm trying to figure out is why my transactions aren't coming back approved even though I'm giving it a good, real credit card, and why it's giving me a Code 3 (Payment Declined), but an error message that cites the relay URL.

The message I posted above is what the site gives me when it hits the Response.Write() line below. It posts the details in the page for a second until the method hits a redirect I have set up in my SimReponse method.  So, the Relay URL (as far as I can tell) is doing its job, but the gateway is still sending back an error.  I can't figure out why... and, I can't really make much sense of the code in order to figure out what's wrong.  This is what my accept method is doing:

[HttpPost]
public ActionResult SimResponse(FormCollection post)
{
var response = new AuthorizeNet.SIMResponse(post);
Response.Write(response.ToString());

Thread.Sleep(10000);

//first order of business - validate that it was Auth.net that posted this using the
//MD5 Hash passed to use from Auth.net
var isValid = response.Validate(ConfigHelper.MerchantHash,
ConfigHelper.AuthNetApiLogin);

//if it's not valid - just send them to the home page. Don't throw - that's how
//hackers figure out what's wrong :)
//if(!isValid)
// return Redirect("/");

//pull the order ID from the order

var orderId = Request.Form["order_id"];

recordError(1, "orders", "orderid", orderId.ToString(), "", "", 1);


//pull the order

/*var order = MvcApplication.FindOrder(orderId);*/

//the URL to redirect to
var redirectAction = Url.Action("recentpurchases", "report" /*, new { id = orderId.ToString() }*/);
var returnUrl = Url.SiteRoot() + redirectAction;

var order = new Order();

if (response.Approved)
{
order.AuthCode = response.ToString();
order.TransactionId = response.TransactionID;
//order.OrderMessage = string.Format("Thank you! Order approved: {0}", response.AuthorizationCode);
}
else
{
//pin the message to the order so we can show it to the user
//order.OrderMessage = response.Message;
redirectAction = Url.Action("error", "search");
returnUrl = Url.SiteRoot() + redirectAction;
}

//save the order somewhere
//MvcApplication.SaveOrder(order);

//Direct Post method

return Content(CheckoutFormBuilders.Redirecter(returnUrl));

//or just return the page back to the AuthNet server if you don't want to bounce the return
//MAKE SURE it has absolute URLs
//return Redirect(redirectAction);

}

Sandbox account don't need a real credit card. use 4111111111111111. and make sure testmode is off on the test account.

 

If it still getting the " The referrer, relay response or receipt link URL is invalid."

Did you check it in your merchant test account? it is ssl? you are not using localhost, are you?

Did you setup a default relay response url but using a different one in the form post to authorize.net?