Showing results for 
Search instead for 
Did you mean: 

PHP batch statistics response accountType, chargeAmount, chargeCount

Trying to show a summary of statistics on my server for our accounting department. Reading through the forums and guides, I am a bit stuck. In the XML documentation, the responses seem to indicate that I should be able to look through the statistics for each batch. I have tried several methods to try and see this. Can someone kind of suggest a tip to help me along? Below is my code:



require_once "/anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "xxxxxxxxx");
define("AUTHORIZENET_TRANSACTION_KEY", "xxxxxxxxxxx");
define("AUTHORIZENET_SANDBOX", false);

// Get Settled Batch List
$request = new AuthorizeNetTD;
$includeStatistics = true;
$firstSettlementDate = "2014-07-01T08:15:30";
$lastSettlementDate = "2014-07-09T08:15:30";

$response = $request->getSettledBatchList($includeStatistics,$firstSettlementDate,$lastSettlementDate);

echo count($response->xml->batchList->batch) . " batches<br>";

foreach ($response->xml->batchList->batch as $batch) {
echo "Batch ID: " . $batch->batchId . "<br>";
// I would like to put in the Transaction details here and tried : $response->xml->statistics=>statistic->accountType


// Tried looping through the statistics in the response, and also in the above batch list (which works fine) loop, and also have tried just displaying in on the page - something like:

foreach ($response->xml->statistics->statistic as $stat) {
echo "Account Type: " . $stat->accountType . "<br>";




statistics is a child of batch



Thank you. That helped a lot.


So, then, I should be able to then loop through each batch and see a summary of each accountType, chargeAmount, and chargeCount ?


I appreciate the reply.:smileyhappy:

That sound right.