<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: When the trans is declined, need to capture error message and return either true or false in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51268#M26649</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jun 2015 18:41:30 GMT</pubDate>
    <dc:creator>tlepshev89</dc:creator>
    <dc:date>2015-06-29T18:41:30Z</dc:date>
    <item>
      <title>When the trans is declined, need to capture error message and return either true or false</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51265#M26647</link>
      <description>&lt;P&gt;I am new to authorize.net I need to run a transction and if there is an error, I need to capture it to a string then i need to return false. Can anyone share with me their thoughts on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I currently have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public bool ProccesPayment()&lt;BR /&gt;{&lt;BR /&gt;String post_url = "&lt;A href="https://test.authorize.net/gateway/transact.dll&amp;quot;;" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll";&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string amount = paymentInfo.AmountPaid.ToString();&lt;BR /&gt;string cardNo = paymentInfo.CardNumber.ToString();&lt;BR /&gt;string expDate = paymentInfo.CardExpirationDate.ToString();&lt;BR /&gt;&lt;BR /&gt;Dictionary&amp;lt;string, string&amp;gt; post_values = new Dictionary&amp;lt;string, string&amp;gt;();&lt;BR /&gt;post_values.Add("x_login", "xxxxxxxxxx");&lt;BR /&gt;post_values.Add("x_tran_key", "xxxxxxxxxxx");&lt;BR /&gt;post_values.Add("x_delim_data", "TRUE");&lt;BR /&gt;post_values.Add("x_delim_char", "|");&lt;BR /&gt;post_values.Add("x_relay_response", "FALSE");&lt;BR /&gt;post_values.Add("x_currency_code", "USD");&lt;BR /&gt;post_values.Add("x_type", "AUTH_CAPTURE");&lt;BR /&gt;post_values.Add("x_method", "CC");&lt;BR /&gt;post_values.Add("x_card_num", cardNo);&amp;nbsp;&lt;BR /&gt;post_values.Add("x_exp_date", expDate);&lt;/P&gt;&lt;P&gt;post_values.Add("x_amount", amount);&lt;BR /&gt;post_values.Add("x_description", "McMahon Publishing Group subsription");&lt;/P&gt;&lt;P&gt;String post_string = "";&lt;/P&gt;&lt;P&gt;foreach (KeyValuePair&amp;lt;string, string&amp;gt; post_value in post_values)&lt;BR /&gt;{&lt;BR /&gt;post_string += post_value.Key + "=" + HttpUtility.UrlEncode(post_value.Value) + "&amp;amp;";&lt;BR /&gt;}&lt;BR /&gt;post_string = post_string.TrimEnd('&amp;amp;');&lt;/P&gt;&lt;P&gt;// create an HttpWebRequest object to communicate with Authorize.net&lt;BR /&gt;HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url);&lt;BR /&gt;objRequest.Method = "POST";&lt;BR /&gt;objRequest.ContentLength = post_string.Length;&lt;BR /&gt;objRequest.ContentType = "application/x-www-form-urlencoded";&lt;/P&gt;&lt;P&gt;// post data is sent as a stream&lt;BR /&gt;StreamWriter myWriter = null;&lt;BR /&gt;myWriter = new StreamWriter(objRequest.GetRequestStream());&lt;BR /&gt;myWriter.Write(post_string);&lt;BR /&gt;myWriter.Close();&lt;/P&gt;&lt;P&gt;// returned values are returned as a stream, then read into a string&lt;BR /&gt;String post_response;&lt;BR /&gt;HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();&lt;BR /&gt;using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))&lt;BR /&gt;{&lt;BR /&gt;post_response = responseStream.ReadToEnd();&lt;BR /&gt;responseStream.Close();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I took this from the demo AIM project that sendbox is offering. But, I cant really understand and capture the respone message. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 16:47:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51265#M26647</guid>
      <dc:creator>tlepshev89</dc:creator>
      <dc:date>2015-06-29T16:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: When the trans is declined, need to capture error message and return either true or false</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51267#M26648</link>
      <description>&lt;P&gt;here is the AIM response doc&lt;/P&gt;&lt;P&gt;&lt;A href="http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=4_TransResponse.07.1.html" target="_blank"&gt;http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=4_TransResponse.07.1.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 17:59:55 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51267#M26648</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2015-06-29T17:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: When the trans is declined, need to capture error message and return either true or false</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51268#M26649</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 18:41:30 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/When-the-trans-is-declined-need-to-capture-error-message-and/m-p/51268#M26649</guid>
      <dc:creator>tlepshev89</dc:creator>
      <dc:date>2015-06-29T18:41:30Z</dc:date>
    </item>
  </channel>
</rss>

