Reply
Member
Posts: 1
Registered: ‎04-06-2018

Detecting a failed authorization

We are having some issues handeling the return transactionResponse to detect failed Transactions. At first we were just tesing for a response code of 2, but found that a decline isnt the only return for a failed transaction. So we decided to go with testing if the authcode was all 0s, or null to check for failed transactions. That does not seem to work as a declined transaction came back with a authCode that was neither all zeros or null but a six digit integer. What different scenarios and checks would we need to do to detect a failed authorization? C# sample code:

 

if(response.messages.resultCode == messageTypeEnum.Error) throw new Exception("OrderCreditCardController.CapturePayment: " + GetResponseMessage(response));

 

AuthorizeCode = response.transactionResponse.authCode;

 

//checks for null and All zeros

if (!IsAuthorizeCodeValid(AuthorizeCode)) throw new Exception("OrderCreditCardController.AuthorizePayment:" + response.transactionResponse.responseCode + " " + GetResponseMessage(response));

 

Posts: 416
Topics: 0
Kudos: 87
Blog Posts: 0
Ideas: 0
Solutions: 33
Registered: ‎04-28-2017

Re: Detecting a failed authorization

[ Edited ]

Why not check if the responseCode is !=1 for a declined transaction or transId > 0 for an approved transaction?

Powered by NexWebSites.com -
Certified Authorize.net developers
Highlighted
Member
Posts: 1
Registered: ‎10-09-2018

Re: Detecting a failed authorization

krogerfeedback


@johnnyc wrote:

We are having some issues handeling the return transactionResponse to detect failed Transactions. At first we were just tesing for a response code of 2, but found that a decline isnt the only return for a failed transaction. So we decided to go with testing if the authcode was all 0s, or null to check for failed transactions. That does not seem to work as a declined transaction came back with a authCode that was neither all zeros or null but a six digit integer. What different scenarios and checks would we need to do to detect a failed authorization? C# sample code:

 

if(response.messages.resultCode == messageTypeEnum.Error) throw new Exception("OrderCreditCardController.CapturePayment: " + GetResponseMessage(response));

 

AuthorizeCode = response.transactionResponse.authCode;

 

//checks for null and All zeros

if (!IsAuthorizeCodeValid(AuthorizeCode)) throw new Exception("OrderCreditCardController.AuthorizePayment:" + response.transactionResponse.responseCode + " " + GetResponseMessage(response));

 


Thank goodness i have found someone else experiencing the same problem.