cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Issues with API when getting Reponses

I am experiencing issues getting transaction information from the API. I'm currently using the latest version of the PHP (2.0.2) sdk from https://github.com/AuthorizeNet/sdk-php. I am repeatedly receiving "null" responses from the API.

 

I have code that looks like the following:

global $merchantAuthentication;
$refId = 'ref' . time();

$request = new AnetAPI\GetTransactionDetailsRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setTransId($transactionId);

$controller = new AnetController\GetTransactionDetailsController($request);
echo "\r\nThe transaction id is: " . $transactionId . "\r\n";
echo "\r\nThe controller is: \r\n";
var_dump($controller);
echo "\r\n";

$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);

echo "\r\n######################################################\r\n";
echo "\r\nThe response is:\r\n ";
var_dump($response);

 

When I run this, it will put the data for 1-3 transactions and then on the 4th transaction, I get a "NULL" for the response object.


######################################################
The response is:
NULL
######################################################

I am at a lost why I keep getting a null response. The issue is not exclusively happening with a single transaction. When I rerun the above code, sometimes the response object contains all of the transaction details like it should. When I rerun the code, it will fail.

Example Run 1:

The transaction id is: 63827567112
The controller is: object(net\authorize\api\controller\GetTransactionDetailsController)#71 (6) { ... }
The response is: object(net\authorize\api\contract\v1\GetTransactionDetailsResponse)#55 (6) { ... the good reponse }

Example Run 2:

The transaction id is: 63827567112
The controller is: object(net\authorize\api\controller\GetTransactionDetailsController)#71 (6) { ... }
The response is: NULL

I've tried adding pauses between each transaction in case I was hitting a rate limit or something, but this did not help.

eneerge
Member
6 REPLIES 6

I will also say, that the code that I have has been in use for a little over 3 years or so. We did not start having this issue until about a week and a half ago.

eneerge
Member

Yeah this is server side. When I add loops around the code to retry getting the information, it goes through. I set the retry to 3 and that got most of my information, but I'm going to have to increase the retries because there were still a few transactions that failed after 3 attempts.

This is either a server issue on authorize.net, network issue on authorize.net, or it could perhaps be a network issue on my side as well, but we have no signs there's any network issues on our side. Any changes on Auth.net in the last week or so?

eneerge
Member

I'm not familiar with Discogs but your problem seems to be related to some sort of failure while authenticating with Discogs (I assume the problem isn't specific to the marketplace/listings endpoint, rather with any discogs endpoint, correct?)

You mentioned doing the oauth flow for your app, yet in your example you're showing the usage of a key & secret combo. This seems related to the Discogs auth flow  AuthenticationShagleVoojio which is a different flow.

Citing the Discogs docs,

BUT using the key and secret does not identify the requester as any particular user, and as such will not grant access to any resources users should be able to see on their own account (e.g. marketplace orders, private inventory fields, private collections). You will need to use either of the token options for these resources.

If possible, try to generate a token as suggested by the documentation and see if it solves your issue.

Hi, can you elaborate more information about it, sometime the API keys face some errors but these are fixable things. You can easily sort out. 

Mazijonn
Contributor

Hello,

I am still having this issue. The only way I could work around the issue is by getting it to continuously retry the request. This is causing a significant slow down (10m+ to retrieve the data).

Log info below shows that it keeps having to send the same request up to 7 times before it gets a response that is not "null". Currently I have my retry trigger set to 20. I've not hit that many retries, yet, but this does seem to be getting worse.

Getting batches between 10/26/2022 13:00:00 and 10/31/2022 12:59:59- Unable to get settled batch list. Attempts: 2. Retrying...- Unable to get settled batch list. Attempts: 3. Retrying...- Unable to get settled batch list. Attempts: 4. Retrying... - Retrieval success.
- Retrieval success.
- Retrieval success.
- Retrieval success.

- <batch number stripped>
- Getting transaction list...- Unable to get transaction list for batch: <stripped>. Attempts: 2. Retrying...
- Getting transactions from transaction list...
- - Transaction: <stripped>
- - Transaction: <stripped>- Unable to get transaction detail for : <stripped>. Attempts: 2. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 3. Retrying...
- - Transaction: <stripped>- Unable to get transaction detail for : <stripped>. Attempts: 2. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 3. Retrying...

- - Transaction: <stripped>
- - Transaction: <stripped>
- - Transaction: <stripped>
- - Transaction: <stripped>

- - Transaction: <stripped>- Unable to get transaction detail for : <stripped>. Attempts: 2. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 3. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 4. Retrying...

- - Transaction: <stripped>- Unable to get transaction detail for : <stripped>. Attempts: 2. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 3. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 4. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 5. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 6. Retrying...- Unable to get transaction detail for : <stripped>. Attempts: 7. Retrying...
eneerge
Member