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.
11-10-2021 08:16 AM
I'm having the same problem. Since we switched to the .NET API from AIM less than two months ago, we've had fifteen customers' transactions return a null result.
Each customer re-submitted their payments several times with the same result, so it does seem to be dependent on that particular card (or billing info).
To get nothing, not even a timeout error or response message is pretty damn unhelpful.
03-01-2022 11:52 AM
Just did some investigating on this and found that in my case it was down to the address info I was submitting with the card. The address field exceeded the 60 character limit. This was replicable in the sandbox - submit a long address and get a null response.
So I guess the rule is that null responses indicate bad data in the request that violates data limitations, in this case field length.
Hope this helps.
03-01-2022 01:07 PM