This is what I have. I'm trying to pull each batches transaction details. It doesn't give me an error, the page is entirely blank.
<?php
//error_reporting(E_ALL);
require_once "anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "4G6V83hNY8hYtu4a");
$includeStatistics = true;
// 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";
$response2 = $request->getTransactionListRequest($batch->batchId);
foreach ($response2->xml->transactions as $transactions) {
echo "Transaction ID: " . $transactions->transaction) . "\n";
}
}
07-15-2014 06:48 AM
so it doesn't even give you "0 batches"?
07-15-2014 06:56 AM
If I remove this:
$response2 = $request->getTransactionListRequest($batch->batchId);
foreach ($response2->xml->transactions as $transactions) {
echo "Transaction ID: " . $transactions->transaction) . "\n";
}
Then it gives me 1 batch. It's like if there is an error at any point, it just breaks the whole page.
07-15-2014 07:22 AM
It had an extra ) in it. Now it returns this, but no transaction detail.
1 batches Batch ID: XXXXXXX
07-15-2014 07:25 AM
This is the line breaking everything:
$response2 = $request->getTransactionListRequest($batch->batchId);
07-15-2014 07:33 AM
echo the $response2
try creating another $request
07-15-2014 07:34 AM - edited 07-15-2014 07:35 AM
It still breaks everything after the batch info. Am I calling the method correctly?
require_once "anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "4G6V83hNY8hYtu4a");
$includeStatistics = true;
// 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";
$request2 = new AuthorizeNetTD;
$response2 = $request2->getTransactionListRequest($batch->batchId);
echo count($response2->xml->transactions->transaction) . " transactions\n";
foreach ($response2->xml->transactions->transaction as $transaction) {
echo "Transaction ID: " . $transaction->transId . "\n";
}
}
print_r("<br />" . $response2);
07-15-2014 07:48 AM
https://github.com/AuthorizeNet/sdk-php/blob/master/lib/AuthorizeNetTD.php
it just getTransactionList without the request
07-15-2014 08:45 AM
Raynor, could you help me out a little on how to execute this? Should the below php code pull a list of transactions onto the screen for July 14th?
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "xxxxx");
define("AUTHORIZENET_SANDBOX", true);
getTransactionsForDay(7,14,2014);
07-18-2014 11:05 AM
Got it!
require_once "/anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "xxxxx");
define("AUTHORIZENET_SANDBOX", true);
$request = new AuthorizeNetTD;
$response = $request->getTransactionsForDay(7,14,2014);
print_r($response);
07-18-2014 11:09 AM