cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with getting response back from AMEX Card Charging

Having trouble with getting response back from AMEX Card Charging: Just does not return any error but does not execute the transaction. continues to spin. I have removed the login and transkey from follows. What do I check? It works for MasterCard, VISA..

 

Using follows:

String post_url = "https://test.authorize.net/gateway/transact.dll";

post_values.Add("x_login", "");

post_values.Add("x_tran_key", "");

post_values.Add("x_version", "3.1");

post_values.Add("x_delim_data", "TRUE");

post_values.Add("x_delim_char", "|");

post_values.Add("x_relay_response", "FALSE");

post_values.Add("x_email_customer", "false");

post_values.Add("x_type", chargeType);

post_values.Add("x_method", "CC");

post_values.Add("x_card_num", CCNum);

//post_values.Add("x_card_code", CCSecCode);

post_values.Add("x_exp_date", datetopass);

post_values.Add("x_amount", Price.ToString());

post_values.Add("x_description", trackingMemberCode + " Transaction");

post_values.Add("x_first_name", HttpContext.Current.Session["custFirstName"].ToString());

post_values.Add("x_last_name", HttpContext.Current.Session["custLastName"].ToString());

post_values.Add("x_Company", HttpContext.Current.Session["custCompany"].ToString());

post_values.Add("x_address", HttpContext.Current.Session["custAddr1"].ToString());

post_values.Add("x_city", HttpContext.Current.Session["custCity"].ToString());

post_values.Add("x_state", HttpContext.Current.Session["custState"].ToString());

post_values.Add("x_zip", HttpContext.Current.Session["custPostalCode"].ToString());

post_values.Add("x_phone", HttpContext.Current.Session["Phone"].ToString());

post_values.Add("x_email", HttpContext.Current.Session["EmailAddress"].ToString());

post_values.Add("x_Ship_To_Address", HttpContext.Current.Session["txtShipAddr1"].ToString());

post_values.Add("x_Ship_To_City", HttpContext.Current.Session["txtShipCity"].ToString());

post_values.Add("x_Ship_To_State", HttpContext.Current.Session["txtShipState"].ToString());

post_values.Add("x_Ship_To_Zip", HttpContext.Current.Session["txtShipPostalCode"].ToString());

post_values.Add("x_tax", taxes.ToString());

post_values.Add("x_tax_exempt", HttpContext.Current.Session["lstBoxTaxExempt"].ToString());

post_values.Add("x_po_num", HttpContext.Current.Session["txtboxPO"].ToString());

post_values.Add("x_Invoice_Num", HttpContext.Current.Session["confnumber"].ToString());

// Additional fields can be added here as outlined in the AIM integration

// guide at: http://developer.authorize.net

// This section takes the input fields and converts them to the proper format

// for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4"

String post_string = "";

foreach (KeyValuePair<string, string> post_value in post_values)

{

post_string += post_value.Key + "=" + HttpUtility.UrlEncode(post_value.Value) + "&";

}

post_string = post_string.TrimEnd('&');

// The following section provides an example of how to add line item details to

// the post string. Because line items may consist of multiple values with the

// same key/name, they cannot be simply added into the above array.

//

// This section is commented out by default.

/*

string[] line_items = {

"item1<|>golf balls<|><|>2<|>18.95<|>Y",

"item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y",

"item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y"};

 

foreach( string value in line_items )

{

post_string += "&x_line_item=" + HttpUtility.UrlEncode(value);

}

*/

// create an HttpWebRequest object to communicate with Authorize.net

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url);

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 post_response;

HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();

using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))

{

post_response = responseStream.ReadToEnd();

responseStream.Close();

}

// the response string is broken into an array

// The split character specified here must match the delimiting character specified above

Array response_array = post_response.Split('|');

return response_array;

daman21
Member
2 REPLIES 2

have you put it in debug and see where is getting stuck?

RaynorC1emen7
Expert

Hello @daman21

 

Some sandbox accounts recently created did not have AMEX enabled.  You can use the contact us form to request it be added, or create a new sandbox account which will have all card brands enabled.

 

Richard