Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 2
Registered: ‎11-10-2021

GetApiResponse() returns NULL for some credit cards

GetApiResponse() returns NULL for some credit cards.

 

For some reason, controller.GetApiResponse() returns NULL for some credit cards. It's not a random thing, for certain cards it always happens. We use the AcceptUI in the frontend. This will get a nonce which we send to the backend. This part always seems to work. But then doing an actual transaction (payment) fails in some cases. Here's the backend code that is used (sdk-dotnet-2.0.1):

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;

ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() {
  name = paymentProvider.LoginId,
  ItemElementName = ItemChoiceType.transactionKey,
  Item = paymentProvider.TransactionKey
};

opaqueDataType opaqueData = new opaqueDataType {
  dataDescriptor = opaqueDataCollection.Get("dataDescriptor"),
  dataValue = opaqueDataCollection.Get("dataValue")
};

paymentType paymentType = new paymentType { Item = opaqueData };

transactionRequestType transactionRequest = new transactionRequestType {
  transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
  amount = paymentProduct.Price,
  payment = paymentType,
  billTo = billingAddress,
  shipTo = new customerAddressType(),
  lineItems = lineItems
};

createTransactionRequest request = new createTransactionRequest { transactionRequest = transactionRequest };

createTransactionController controller = new createTransactionController(request);
controller.Execute();

createTransactionResponse response = controller.GetApiResponse();

 

For some cards, the response is NULL while according to the documentation, response should never be NULL.

 

My questions are:

- Has anybody else had this issue; that certain payments just didn't go through and a NULL response is returned? If so, were you able to resolve this somehow? Was there a pattern? (we have this issue for some cards from China, India, Peru and others. There doesn't seem to be a pattern there).

- Is this a bug in the SDK? Shouldn't it always return a response?

- Is there a way to extract some information out of the controller in these cases? Would a call to controller.GetErrorResponse() help?

 

Unfortunately, we were unable to reproduce this in Sandbox mode and we also weren't able to reproduce in live because we couldn't get access to the credit cards which caused issues.

 

Let me know if you can shed some light on these issues or if more information would help in answering these questions.