【发布时间】:2011-08-30 02:30:49
【问题描述】:
我在理解 authorize.net Transaction Details API (documentation here) 时遇到了一些麻烦。我会尽量简短。
从授权中提取交易状态更新的唯一实用方法(不使用他们的“静默发布”功能,这似乎是一大袋噩梦*),是获取一批已结算交易的列表(假设一天),然后为每个已结算的批次提取交易列表。例如:
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));
然而,有多种可能的交易状态。
这些似乎是“最终的”且不可更改:
- 通讯错误
- refundSettledSuccessfully
- 拒绝
- couldNotVoid
- 已过期
- 一般错误
- 审核失败
- 成功解决
- 结算错误
- 作废
以下似乎是“待定”状态:
- authorizedPendingCapture
- 捕获的PendingSettlement
- refundPendingSettlement
- 等待最终结算
- 待结算
- 审核中
- 更新结算
- FDSPendingReview
- FDSAuthorizedPendingReview
- authorizedPendingRelease
这些,我不确定:
- returnedItem (?)
- 退款 (?)
- chargebackReversal (?)
- approvedReview (?)
getUnsettledTransactionList 只是转储您膝上的最后 1000 个“未解决”交易,包括拒绝、错误等 - 使其非常不可靠,更不用说您必须解析那些垃圾。
所以,我的问题是:
上面的最后四个状态是怎么回事?我应该期待这些改变吗?
其中哪些属于“已解决”批次? (
settlementErrorANDsettledSuccessfully? 只是settledSuccessfully?)定期计费交易 (documentation here) 是否会出现在已结算的批次中?
真的没有办法只从授权中提取“待处理”交易,而忽略所有不相关的
error、declined等?重复计费似乎是必要的——因为否则,应用程序(代替交易 ID)无法知道订阅交易是否存在问题,直到有足够的时间过去,您可以放心地假设它应该出现在一个固定的批次。
* 由于两秒超时、失败且永不与您再次交谈的政策,以及必须依靠用户正确配置其设置
【问题讨论】:
-
您应该在support forums 中询问。他们的员工在那里闲逛,可以为您回答此类问题。
标签: php api payment-gateway authorize.net