Reply
Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

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?

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: PHP - no data returned

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

Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

Re: PHP - no data returned

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?

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: PHP - no data returned

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

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

Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

Re: PHP - no data returned

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.

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: PHP - no data returned

[ Edited ]

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.

Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

Re: PHP - no data returned

"...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.

 

Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

Re: PHP - no data returned

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.

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: PHP - no data returned

[ Edited ]

...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-...

Highlighted
Contributor
Posts: 10
Registered: ‎07-24-2014

Re: PHP - no data returned

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.