我在理解authorize.net交易詳情API(documentation here)時遇到了一些麻煩。我會盡我所能來簡要介紹一下。從authorize.net獲取交易詳情
從授權中提取交易狀態更新的唯一實用方法是(不使用他們的'silent post'功能,這看起來像是一大噩夢*),是獲得一個已結算交易的批次清單日),然後爲每個結算批次提取交易清單。例如:
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));
然而,有很多可能的交易狀態。
這些似乎是 '最終' 的,不可改變的:
- communicationError
- refundSettledSuccessfully
- 下降
- couldNotVoid
- 過期
- generalError
- failedReview
- settledSuccessfully
- settlementError
- 空隙
以下顯示爲 '待處理' 的狀態:
- authorizedPendingCapture
- capturedPendingSettlement
- refundPendingSettlement
- pendingFina lSettlement
- pendingSettlement
- underReview
- updatingSettlement
- FDSPendingReview
- FDSAuthorizedPendingReview
- authorizedPendingRelease
這些,我不知道:
- returnedItem(?)
- 扣款(?)
- chargebackReversal(?)
- approvedReview(?)
的getUnsettledTransactionList只是轉儲最後的1000 '懸而未決' 你的大腿上交易,包括拒絕,錯誤等 - 使它非常不可靠,沒有提到你必須解析那些垃圾。
所以,我的問題是:
什麼上面最後四種狀態了?我應該期望這些改變嗎?
其中哪些進入「已結算」批次? (
settlementError
和settledSuccessfully
?JUSTsettledSuccessfully
?)做定期結算交易(documentation here)即使在結算批次顯示?
難道真的沒有辦法從授權中拉出'掛起'的交易,忽略所有不相關的
error
,declined
等?似乎有必要重複開單 - 因爲否則,應用程序(代替交易ID)無法知道訂閱交易是否有問題,直到有足夠的時間過去,您可以安全地假設它應該顯示在一個結算的批次。
*由於兩秒超時,失敗,和從未談話到你,再政策,加上不必依賴於用戶正確配置其設置
你應該問在[支持論壇](http://community.developer.authorize.net/t5 /集成和 - 檢測/ BD-p/Integration01)。他們的員工掛在那裏,可以爲你解答這樣的問題。 – 2011-05-23 13:20:56