Hi Support,
We had already implemented the Authorize.NET payment gateway in our site using AIM. Now I am trying to get implementing the Order Refund using the “CREDIT”. Please look into the below code snippet.
But I am getting the below error message. Let me know if anything wrong in my code
Error message: (92) The gateway no longer supports the requested method of integration. Authorize.Net
string post_string = string.Empty;
Hashtable post_values = new Hashtable();
//the API Login ID and Transaction Key must be replaced with valid values
#region Authentification
post_values.Add("x_login", this._userLoginName);
post_values.Add("x_tran_key", this._transactionKey);
#endregion
#region General configuration
post_values.Add("x_type", "CREDIT");
post_values.Add("x_trans_id", response1.TransactionID); // Valid Transaction ID return by Authorize.net after placing an order.
post_values.Add("x_card_num", cardNumber); // full credit card number
#endregion
foreach (DictionaryEntry field in post_values)
{
post_string += field.Key + "=" + field.Value + "&";
}
post_string = post_string.TrimEnd('&');
// create an HttpWebRequest object to communicate with Authorize.net
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(m_PostURL);
objRequest.Method = "POST";
objRequest.ContentLength = post_string.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
// post data is sent as a stream
StreamWriter myWriter = null;
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(post_string);
myWriter.Close();
// Returned values are returned as a stream, then read into a string
String postResponse;
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
{
postResponse = responseStream.ReadToEnd();
responseStream.Close();
}
Array responseArray = postResponse.Split('|');
Thanks,
Velusamy
09-30-2011 06:59 AM
Add
x_delim_data=TRUE
x_relay_response=FALSE
09-30-2011 07:11 AM
Hi,
Now i am getting the error like below. I using the sandbox environment.
3,1,5,
A valid amount is required.,,P,0,,,0.00,CC,credit,,,,,,,,,,,,,,,,,,,,,,,,,,5EAA9954CAAC35BE636F5CADFA9C7BF7,,,,,,,,,,,,,XXXX4444,MasterCard,,,,,,,,,,,,,,,,
Thanks,
Velu
09-30-2011 08:04 AM
Add the amount to credit like
x_amount=99.95
09-30-2011 08:10 AM - edited 09-30-2011 08:11 AM
Hi ,
Thanks for the update. I have added the amount. But now its shows different error
"The referenced transaction does not meet the criteria for issuing a credit".
What i was doing here.
1. Place an order and checked order has approved.
2. Immediately i am trying to refund the order for that transatcion with Transaction ID.
Thanks,
Velus
09-30-2011 08:29 AM
A transaction have to be settled first before you can issue a CREDIT.
If it is unsettled you can use a VOID transaction. For VOID transaction, you do not need the x_amount and x_card_num.
09-30-2011 08:38 AM