I'm having some trouble making sense of the authorize.net Transaction Details API (documentation here). I'll try my best to be brief.
The only practical way of pulling transaction status updates from authorize (without using their 'silent post' feature, which seems like a big bag of nightmares* ), is to get a batch list of settled transactions (for let's say a day) and then pull transaction lists for every settled batch. Eg:
public function getTransactionsForDay($month = false, $day = false, $year = false)
{
$transactions = array();
$month = ($month ? $month : date('m'));
$day = ($day ? $day : date('d'));
$year = ($year ? $year : date('Y'));
$firstSettlementDate = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6);
$lastSettlementDate = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6);
$response = $this->getSettledBatchList(true, $firstSettlementDate, $lastSettlementDate);
$batches = $response->xpath("batchList/batch");
foreach ($batches as $batch) {
$batch_id = (string)$batch->batchId;
$request = new AuthorizeNetTD;
$tran_list = $request->getTransactionList($batch_id);
$transactions = array_merge($transactions, $tran_list->xpath("transactions/transaction"));
}
return $transactions;
}
$request = new AuthorizeNetTD;
$transactions = $request->getTransactionsForDay(12, 8, 2010);
$this->assertTrue(is_array($transactions));
Yet, there's a multitude of possible transaction statuses.
These appear to be 'final' and unchangeable:
- communicationError
- refundSettledSuccessfully
- declined
- couldNotVoid
- expired
- generalError
- failedReview
- settledSuccessfully
- settlementError
- voided
The following appear to be 'pending' statuses:
- authorizedPendingCapture
- capturedPendingSettlement
- refundPendingSettlement
- pendingFinalSettlement
- pendingSettlement
- underReview
- updatingSettlement
- FDSPendingReview
- FDSAuthorizedPendingReview
- authorizedPendingRelease
These, I'm not sure about:
- returnedItem (?)
- chargeback (?)
- chargebackReversal (?)
- approvedReview (?)
The getUnsettledTransactionList just dumps the last 1000 'unsettled' transactions on your lap, including declined, error, etc -- making it pretty unreliable, not mention you have to parse that junk.
So, my questions are:
What's up with the last four statuses above? Should I expect those to change or not?
Which of these go into a 'settled' batch? (
settlementError
ANDsettledSuccessfully
? JUSTsettledSuccessfully
? )Do recurring billing transactions (documentation here) even show up in the settled batches?
Is there really no way to pull just the 'pending' transactions from authorize, ignoring all the irrelevant
error
,declined
, etc ones? It seems necessary for recurring billing -- because otherwise, an app (in lieu of a transaction id) has no way of knowing if there's a problem with a subscription transaction, until enough time passes that you can safely assume it should have showed up in a settled batch.
* due to the two second timeout, fail-and-never-talk-to-you-again policy, plus having to rely on users to properly configure their settings