Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 3
Registered: ‎09-30-2011

Refund using AIM - Error

 

 

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

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

Re: Refund using AIM - Error

Add

x_delim_data=TRUE

x_relay_response=FALSE

Member
Posts: 3
Registered: ‎09-30-2011

Re: Refund using AIM - Error

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

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

Re: Refund using AIM - Error

[ Edited ]

Add the amount to credit like

x_amount=99.95

Member
Posts: 3
Registered: ‎09-30-2011

Re: Refund using AIM - Error

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

 

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

Re: Refund using AIM - Error

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.