I've got the following:
<div id="AuthorizeDiv" style="visibility:collapse" runat="server"> <%=AuthorizeNet.Helpers.CheckoutFormBuilders.CreditCardForm(false) %> </div> IGateway OpenGateway() { //we used the form builder so we can now just load it up //using the form reader var login = ConfigurationManager.AppSettings["ApiLogin"]; var transactionKey = ConfigurationManager.AppSettings["TransactionKey"]; var gate = new Gateway(login, transactionKey, false); return gate; } var gate = OpenGateway(); //build the request from the Form post var apiRequest = CheckoutFormReaders.BuildAuthAndCaptureFromPost(); apiRequest.Queue(ApiFields.Amount, OrderTotal.ToString()); //send to Auth.NET var response = gate.Send(apiRequest); string code = response.ResponseCode; if (code.Length > 0 && code != "1") { throw new Exception("Error processing Authorize.net transaction. Error code: " + code + " - " + response.Message); } else { if (!response.Approved) { throw new Exception("Authorize.net transaction not approved. Error code: " + code + " - " + response.Message); } }
Am I just missing something or misunderstanding something about how this works?
04-23-2013 09:58 AM
error compiling? response code 3?
04-23-2013 12:27 PM
No compilation errors and no response codes when calling the code. It never shows on the list of transactions that have gone through though.
Is there some way to test live code that I'm not aware of? None of the testing tools help.
04-24-2013 08:25 AM - edited 04-24-2013 08:26 AM
If the live account is in testmode. Transaction will not get save.
so code is blank?
string code = response.ResponseCode;
04-24-2013 08:48 AM
It's not in test mode. No exceptions are thrown so the code is blank.
This shouldn't be this difficult IMO. I would think it would just work. :(
04-24-2013 09:36 AM
var response = gate.Send(apiRequest);
response is blank too?
04-24-2013 01:09 PM
The object is not null and the response.Approved property is true.
04-25-2013 10:57 AM
That default to true.
I would said it erroring trying to connect to https://secure.authorize.net/gateway/transact.dll
but debug the code to be sure.
04-25-2013 12:12 PM