- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
empty response code
We are using the Java SDK version 1.9.2
We suffer from an intermittent issue when trying to get
the response code from a charge transaction attempt. Here is our code making a charge transaction: PaymentType paymentType = new PaymentType(); CreditCardType creditCard = new CreditCardType(); creditCard.setCardNumber(cardNumber); creditCard.setExpirationDate(expDate); creditCard.setCardCode(cardCode); paymentType.setCreditCard(creditCard); TransactionRequestType txnRequest = new TransactionRequestType(); txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value()); txnRequest.setPayment(paymentType); txnRequest.setAmount(amount); txnRequest.setCurrencyCode(currencyCode); CreateTransactionRequest apiRequest = new CreateTransactionRequest(); MerchantAuthenticationType merchant = new MerchantAuthenticationType(); merchant.setName(merchId); merchant.setTransactionKey(secret); apiRequest.setMerchantAuthentication(merchant); apiRequest.setTransactionRequest(txnRequest); CreateTransactionController controller = new CreateTransactionController(apiRequest); controller.execute(this.environment); CreateTransactionResponse response = controller.getApiResponse(); ---- At this point, sometimes the response object is actually NULL. This issue is discussed on the following page yet there was no clear or helpful response from anyone at authorize.net: https://community.developer.authorize.net/t5/Integration-and-Testing/NULL-RESPONSE-ISSUE/td-p/58657 More common for us, however, is that the CreateTransactionResponse object is not null, but the TransactionResponse object (from calling response.getTransactionResponse()) returns NULL for getResponseCode(). So we have no clue what happened on authorize.net's end and we must assume an unknown error occurred. Any insight, suggestions, or additional steps we should take to avoid this problem would be much appreciated.
โ04-09-2019 12:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm headed down this path right now, not sure if it the right path or not just an FYI...
If the Response is null, then read the ErrorResponse...
ANetApiResponse errorResponse = controller.GetErrorResponse();
if (errorResponse.messages.message.Length > 0)
result = errorResponse.messages.message[0].code + "," + errorResponse.messages.message[0].text;
โ04-09-2019 01:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you djtemmel, I appreciate your suggestion and will give this a try.
โ04-09-2019 05:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, this seems to be working for me. I'm now getting actual error messages instead of nothing...
(example) Failed Authorize.net payment: "E00003,The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:name' element is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value."
โ04-10-2019 12:32 PM