How to find the transaction is settled/Unsettled in Authorize.net?

故事扮演 提交于 2020-01-12 19:14:27

问题


How Can I find whether the transaction made by user is settled or Unsettled in the authorize.net.I am using AIM. I want to get through coding.When the transaction is completed and I cant find transaction status.But I want to get whether it goes for settled or unsettled transaction. Thanks in advance.


回答1:


You cannot get this information through coding as no API Authorize.Net offers allows for this. It can only be done through the control panel. When you process a transaction and it is approved you can assume the transaction is unsettled. Transactions are settled once per day usually around midnight Pacific Time. After that you can assume a transaction is settled.




回答2:


As of 03-16-2011 authorize.net has released two new calls to the Transaction Details API, getUnsettledTransactionList and getBatchStatistics.

getUnsettledTransactionList returns up to 1,000 unsettled transactions per call, returning the most recent transactions. The information returned in the response will be the same as what's returned in getTransactionList call.

getBatchStatistics returns the batch stats for a single batch like settlement state and time, charge count, decline count, etc.

For more info, check out the XML guide and the SOAP guide.

At the time of writing the PHP SDK is at version 1.1.6 and does not have this function built into the TD api, however if you look at the documentation provided above, as well as this example page, you will see that getting a list of unsettled transactions is in fact possible.

from this page




回答3:


I've followed this link http://developer.authorize.net/api/transaction_details/ and get this code from there,

<?php
require_once "anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");

// 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";
}

// Get Transaction Details
$transactionId = "12345";
$response = $request->getTransactionDetails($transactionId);
echo $response->xml->transaction->transactionStatus;

but I m getting this error message.

User authentication failed due to invalid authentication values.




回答4:


As suggested in @cwd's answer, the most reliable way to know if a transaction is settled is to call getUnsettledTransactionList or getBatchStatistics, but you can also just check what your Transaction Cut-off Time is set to.

Log in to your Authorize.net admin, click Account > Transaction Cut-Off Time

My account is set to 4:00 PM PDT so you can just compare your transaction time to the cut off time. Something like:

$createdTime = new DateTime($charge['createdTime']);

// starting point for settle time
$settleTime = new DateTime($createdTime->format('Y-m-d') . ' 16:00:00');
$now = new DateTime();

// if card was charged after settle time for 
// that day, move settle time to the next day
if ($createdTime > $settleTime) {
    $settleTime->add(new DateInterval('P1D'));
}

if ($now > $settleTime) $settled = true;



回答5:


http://developer.authorize.net/api/transaction_details/ is the API you are looking for.



来源:https://stackoverflow.com/questions/3185304/how-to-find-the-transaction-is-settled-unsettled-in-authorize-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!