cancel
Showing results for 
Search instead for 
Did you mean: 

PHP - no data returned

I am attempting to pull transaction and batchlist data from PHP. I have a live account and valid API Login and Key. And I have actvated the Transaction Details API.

 

This accout has been LIVE for years and has many transactions and batches. However, I get 0Batches and no details using a known valid transaction ID.

 

	echo "<br>****** Authorize.Net ******<br>";
	
	require_once "../../anet_php_sdk/AuthorizeNet.php";
	define("AUTHORIZENET_API_LOGIN_ID", "***********");
	define("AUTHORIZENET_TRANSACTION_KEY", "****************");
	
	// Get Settled Batch List
	$request = new AuthorizeNetTD;
	$response = $request->getSettledBatchList();
	echo count($response->xml->batchList->batch) . " batches\n";
	foreach ($response->xml->batchList->batch as $batch) {
		echo "Batch ID: " . $batch->batchId . "\n";
	}
	
	// Get Transaction Details
	$transactionId = "6356645336";
	$response = $request->getTransactionDetails($transactionId);
	echo $response->xml->transaction->transactionStatus;

 Any thoughts on why? I activated Transaction Details API this morning. Does it take time to take effect?

toddmfletcher
Contributor
11 REPLIES 11

Have you try just echo the $response to see if there is anything return?

RaynorC1emen7
Expert

An echo $response returns nothing. 

 

Is there a public developer test api_login_id and transactions_key and transaction id I can use to ensure the code is sound?

there isn't a public one, but you get a new test sandbox account

https://developer.authorize.net/sandbox/

Yeah. I have had a sandbox account as well as two live accounts that have been around for years.

 

Is there any documentation on the $response object that can assist is debug? It seems od to just get nothing. No errors, nothing. Perhaps there is documentation on that 'nothing' means.

It the response is blank, you could look at the php code and see where it failing. One of the thing they did recently was response with gzip compression if your request header ask for it.

"...look at the php code and see where it failing..."

 

The only code I am using is the code they provide.

 

 

	require_once "../../anet_php_sdk/AuthorizeNet.php";
	define("AUTHORIZENET_API_LOGIN_ID", "*********");
	define("AUTHORIZENET_TRANSACTION_KEY", "**********");
	
	// Get Settled Batch List
	$request = new AuthorizeNetTD;
	$response = $request->getSettledBatchList();
	echo count($response->xml->batchList->batch) . " batches\n";
	foreach ($response->xml->batchList->batch as $batch) {
		echo "Batch ID: " . $batch->batchId . "\n";
	}
	
	// Get Transaction Details
	$transactionId = "6356645336";
	$response = $request->getTransactionDetails($transactionId);
	echo $response->xml->transaction->transactionStatus;
	echo $repsonse;

 The code isn't indicating an error. Only that there is no data to return and echo. I know there are hundreds of batchs and transactions. 

 

"...response with gzip compression if your request header ask for it..."

 

I'm not sure what you mean. Can you expound on this?

 

Thank you again for your replies. It is appriciated.

 

Addtional Note:

 

I used a developer sandbox account credentials and it returns the exact same scenario. The Authorize.net  sample.php code for various functionality seem to work fine with those developer sandbox account credentials.

...look at the php code and see where it failing..."

 

The only code I am using is the code they provide.

 

When you download the php sdks, it should be the code too?

 

 

"...response with gzip compression if your request header ask for it..."

 

I'm not sure what you mean. Can you expound on this?

http://community.developer.authorize.net/t5/Integration-and-Testing/Authorize-net-has-updated-their-...

Thanks for the link. It does appear that :

 

gzip compression

enabled

 

So I will look into the solution that was posted in your link, and I'll be back here with results.