Transaction Details API

Allows developers to access transaction history and details programmatically.

Retrieving transaction details through the Transaction Details API is Authorize.Net's solution for developers looking to extract reporting and statistical data on existing transactions.

Gaining access to the details of previously processed transactions is important for reporting and reconciliation. The Transacton Details API allows merchants to retrieve the following sets of data:

  • Batch settlement information, including statistics broken out by payment type.
  • Limited transaction details for specific batch requests.
  • Full transactional details for specific transaction IDs.
  • Limited transaction details for unsettled transactions.
  • Batch statistics by payment type for a specified batch ID.

SDKs

PHP Show Usage Download

<?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;

Ruby Show Usage Download

require 'rubygems'
require 'authorize_net'
API_LOGIN
= 'YOUR_API_LOGIN'
API_KEY
= 'YOUR_TRANSACTION_KEY'

# Get Settled Batch List
transaction
= AuthorizeNet::Reporting::Transaction.new(API_LOGIN,
  API_KEY
, :gateway => :sandbox)
response
= transaction.get_settled_batch_list
batches
= response.batch_list
puts batches
.length.to_s + ' batches in list'

# Get Details for a Transaction
transaction
= AuthorizeNet::AIM::Transaction.new(API_LOGIN,
  API_KEY
, :gateway => :sandbox)
credit_card
= AuthorizeNet::CreditCard.new('4111111111111111', '1120')
response
= transaction.purchase('10.00', credit_card)

if response.success?
  puts
"Successfully made a purchase"
  puts
"(authorization code:#{response.authorization_code})"
  transaction
= AuthorizeNet::Reporting::Transaction.new(API_LOGIN,
    API_KEY
, :gateway => :sandbox)
  response
= transaction.get_transaction_details(response.transaction_id)
  transaction
= response.transaction
  puts
"Transaction status: #{transaction.status}"
else
 
raise 'Failed to make purchase.'
end

Java Show Usage Download

<%@ page import="net.authorize.Merchant" %>
<%@ page import="net.authorize.Environment" %>
<%@ page import="net.authorize.Transaction" %>
<%@ page import="net.authorize.reporting.*" %>

<%
 
String apiLoginID = "YOUR_API_LOGIN_ID";
 
String transactionKey = "YOUR_TRANSACTION_KEY";

 
Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
              apiLoginID
, transactionKey);

  net
.authorize.reporting.Transaction transaction =
    merchant
.createReportingTransaction(
    net
.authorize.reporting.TransactionType.GET_SETTLED_BATCH_LIST);
  net
.authorize.data.xml.reporting.ReportingDetails reportingDetails =
    net
.authorize.data.xml.reporting.ReportingDetails.createReportingDetails();
  reportingDetails
.setBatchIncludeStatistics(true);
  transaction
.setReportingDetails(reportingDetails);

 
Result<Transaction> result =
   
(Result<Transaction>)merchant.postTransaction(transaction);

 
out.println("Result Code: " +
   
(result.getResultCode() != null ? result.getResultCode() : "No result code")
   
+ "<br>");
 
for(net.authorize.data.xml.reporting.BatchDetails batchDetail :
      result
.getReportingDetails().getBatchDetailsList()) {
   
out.println("<hr/>");
   
out.println("* id: "
     
+ batchDetail.getBatchId() + "<br>");
   
out.println("* settlementState: "
     
+ batchDetail.getSettlementState().value() + "<br>");
   
out.println("* local settlementTime: "
     
+ batchDetail.getSettlementTimeLocal().toString() + "<br>");
   
out.println("* UTC settlementTime: "
     
+ batchDetail.getSettlementTimeUTC().toString() + "<br>");
   
out.println("* paymentMethod: "
     
+ batchDetail.getPaymentMethod() + "<br>");
   
for(net.authorize.data.xml.reporting.BatchStatistics batchStat :
        batchDetail
.getBatchStatisticsList()) {
     
out.println("<table>");
     
out.println("<tr><td>accountType</td><td>"
       
+ batchStat.getAccountType()+"</td></tr>");
     
out.println("<tr><td>chargeAmount</td><td>"
       
+ batchStat.getChargeAmount()+"</td></tr>");
     
out.println("<tr><td>chargebackAmount</td><td>"
       
+ batchStat.getChargebackAmount()+"</td></tr>");
     
out.println("<tr><td>chargebackCount</td><td>"
       
+ batchStat.getChargebackCount()+"</td></tr>");
     
out.println("<tr><td>chargeChargebackAmount</td><td>"
       
+ batchStat.getChargeChargebackAmount()+"</td></tr>");
     
out.println("<tr><td>chargeChargebackCount</td><td>"
       
+ batchStat.getChargeChargebackCount()+"</td></tr>");
     
out.println("<tr><td>chargeCount</td><td>"
       
+ batchStat.getChargeCount()+"</td></tr>");
     
out.println("<tr><td>chargeReturnedItemsAmount</td><td>"
       
+ batchStat.getChargeReturnedItemsAmount()+"</td></tr>");
     
out.println("<tr><td>chargeReturnedItemsCount</td><td>"
       
+ batchStat.getChargeReturnedItemsCount()+"</td></tr>");
     
out.println("<tr><td>correctionNoticeCount</td><td>"
       
+ batchStat.getCorrectionNoticeCount()+"</td></tr>");
     
out.println("<tr><td>declineCount</td><td>"
       
+ batchStat.getDeclineCount()+"</td></tr>");
     
out.println("<tr><td>errorCount</td><td>"
       
+ batchStat.getErrorCount()+"</td></tr>");
     
out.println("<tr><td>refundAmount</td><td>"
       
+ batchStat.getRefundAmount()+"</td></tr>");
     
out.println("<tr><td>refundCount</td><td>"
       
+ batchStat.getRefundCount()+"</td></tr>");
     
out.println("<tr><td>refundChargebackAmount</td><td>"
       
+ batchStat.getRefundChargebackAmount()+"</td></tr>");
     
out.println("<tr><td>refundReturnedItemsAmount</td><td>"
       
+ batchStat.getRefundReturnedItemsAmount()+"</td></tr>");
     
out.println("<tr><td>refundReturnedItemsCount</td><td>"
       
+ batchStat.getRefundReturnedItemsCount()+"</td></tr>");
     
out.println("<tr><td>returnedItemAmount</td><td>"
       
+ batchStat.getReturnedItemAmount()+"</td></tr>");
     
out.println("<tr><td>returnedItemCount</td><td>"
       
+ batchStat.getReturnedItemCount()+"</td></tr>");
     
out.println("<tr><td>voidCount</td><td>"
       
+ batchStat.getVoidCount()+"</td></tr>");
     
out.println("</table>");
   
}
 
}
%>

C# Show Usage Download

//open a call to the Gateway
var gate = new ReportingGateway("YOUR_API_LOGIN", "YOUR_TRANSACTION_KEY");

//Get all the batches settled
var batches = gate.GetSettledBatchList();

Console.WriteLine("All Batches in the last 30 days");

//Loop each batch returned
foreach (var item in batches) {
   
Console.WriteLine("Batch ID: {0}, Settled On : {1}", item.ID,
                      item
.SettledOn.ToShortDateString());
}

Console.WriteLine("*****************************************************");
Console.WriteLine();

//get all Transactions for the last 30 days
var transactions = gate.GetTransactionList();
foreach (var item in transactions) {
   
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}",
                      item
.TransactionID, item.CardNumber,
                      item
.SettleAmount.ToString("C"),
                      item
.DateSubmitted.ToShortDateString());
}

iOS Show Usage Download

// Notes:
// The first time you login in using the loginToGateway code your call will fail
// if using an unregistered device. Enable it by visiting test.authorize.net >
// Account > Settings > Mobile Device Management > Enable Device
// You also must have the Transaction Details API enabled to use these APIs
// Enable it by visiting test.authroize.net > Account > Settings > Transaction
// Details API > Enter your secret to enable.

TestAppDelegate.h

#import <UIKit/UIKit.h>
#import "AuthNet.h"

@interface TestAppDelegate : NSObject <UIApplicationDelegate, AuthNetDelegate> {
   
NSString *sessionToken;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

TestAppDelegate.m


#import "TestAppDelegate.h"

@implementation TestAppDelegate


@synthesize window=_window;

- (void) loginToGateway {
   
MobileDeviceLoginRequest *mobileDeviceLoginRequest =
       
[MobileDeviceLoginRequest mobileDeviceLoginRequest];
    mobileDeviceLoginRequest
.anetApiRequest.merchantAuthentication.name =
       
<USERNAME>;
    mobileDeviceLoginRequest
.anetApiRequest.merchantAuthentication.password =
       
<PASSWORD>;
    mobileDeviceLoginRequest
.anetApiRequest.merchantAuthentication.mobileDeviceId =
       
[[[UIDevice currentDevice] uniqueIdentifier]
        stringByReplacingOccurrencesOfString
:@"-" withString:@"_"];

   
AuthNet *an = [AuthNet getInstance];
   
[an setDelegate:self];
   
[an mobileDeviceLoginRequest: mobileDeviceLoginRequest];
}

- (void) queryGetSettledBatchList {
   
GetSettledBatchListRequest *getSettledBatchListRequest =
       
[GetSettledBatchListRequest getSettlementBatchListRequest];
    getSettledBatchListRequest
.anetApiRequest.merchantAuthentication.sessionToken =
        sessionToken
;
    getSettledBatchListRequest
.anetApiRequest.merchantAuthentication.mobileDeviceId =
       
[[[UIDevice currentDevice] uniqueIdentifier]
        stringByReplacingOccurrencesOfString
:@"-" withString:@"_"];
   
[[AuthNet getInstance] setDelegate:self];
   
[[AuthNet getInstance]
    getSettledBatchListRequest
: getSettledBatchListRequest];
}

- (void) queryGetTransactionDetailsWithTransId:(NSString*)transId {
   
GetTransactionDetailsRequest *r =
       
[GetTransactionDetailsRequest getTransactionDetailsRequest];
    r
.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;
    r
.anetApiRequest.merchantAuthentication.mobileDeviceId =
       
[[[UIDevice currentDevice] uniqueIdentifier]
        stringByReplacingOccurrencesOfString
:@"-" withString:@"_"];
    r
.transId = transId;
   
[[AuthNet getInstance] setDelegate:self];
   
[[AuthNet getInstance] getTransactionDetailsRequest:r];
}

- (void) queryGetTransactionList:(NSString*)batchId {

   
GetTransactionListRequest *r =
       
[GetTransactionListRequest getTransactionListRequest];
    r
.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;
    r
.anetApiRequest.merchantAuthentication.mobileDeviceId =
       
[[[UIDevice currentDevice] uniqueIdentifier]
        stringByReplacingOccurrencesOfString
:@"-" withString:@"_"];

   
// Batch Lists are from oldest to newest so use last object.
    r
.batchId = batchId;
   
[[AuthNet getInstance] getTransactionListRequest:r];
}

- (void) requestFailed:(AuthNetResponse *)response {
   
// Handle a failed request
}

- (void) connectionFailed:(AuthNetResponse *)response {
   
// Handle a failed connection
}

- (void) mobileDeviceLoginSucceeded:(MobileDeviceLoginResponse *)response {
        sessionToken
= [response.sessionToken retain];
       
[self queryGetSettledBatchList];
}

- (void) getSettledBatchListSucceeded:(GetSettledBatchListResponse *)response {
   
NSArray *batchList = [NSMutableArray arrayWithArray:response.batchList];
   
BatchDetailsType *batchDetail = nil;

       
for(BatchDetailsType *batchDetails in batchList) {
               
NSLog(@"Batch ID: %@, Settled On : %@", batchDetails.batchId,
            batchDetails
.settlementTimeLocal);
        batchDetail
= batchDetails;
       
}

   
[self queryGetTransactionList:batchDetail.batchId];
}

- (void) getTransactionListSucceeded:(GetTransactionListResponse *)response {
   
TransactionSummaryType *transaction = [response.transactions objectAtIndex:0];

   
[self queryGetTransactionDetailsWithTransId:transaction.transId];
}

- (void) getTransactionDetailsSucceeded:(GetTransactionDetailsResponse *)response {
   
NSLog(@"%@",response.transactionDetails.transactionStatus);
}

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions
:(NSDictionary *)launchOptions {

   
// Override point for customization after application launch.
       
// Create a AuthNet singleton with ENV set to test.
       
[AuthNet authNetWithEnvironment:ENV_TEST];

       
[self loginToGateway];

   
[self.window makeKeyAndVisible];
   
return YES;
}

...

- (void)dealloc
{
   
[_window release];
   
[super dealloc];
}

@end

Android Show Usage Download

package net.authorize;

import net.authorize.android.AuthNet;
import net.authorize.android.SimpleActivity;
import net.authorize.android.button.AuthNetButton;
import net.authorize.data.reporting.BatchDetails;
import net.authorize.data.reporting.BatchStatistics;
import net.authorize.data.reporting.ReportingDetails;
import net.authorize.reporting.TransactionType;
import net.authorize.xml.MessageType;
import net.authorize.xml.Result;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

public class ExampleActiviy extends SimpleActivity {

   
/**
     * Called when the activity is first created.
     */

   
@Override
   
public void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
       
// load merchant info
        setContentView
(R.layout.main);

        authNetObj
= AuthNet.getInstance(Environment.SANDBOX,
            R
.layout.authnet_credentials_dialog, R.id.authnet_loginid_edit,
            R
.id.authnet_password_edit, R.id.authnet_auth_cancel_button,
            R
.id.authnet_auth_login_button);

       
// prepare the txnDetail button
       
AuthNetButton settledBatchButton = authNetObj.getButton(this,
           
"Settled Batch List");
        settledBatchButton
.setOnClickListener(new OnClickListener() {

           
public void onClick(View arg0) {
                launchSettledBatchListIntent
();
           
}
       
});

       
LinearLayout layout = (LinearLayout) findViewById(R.id.MainLayout);
        layout
.addView(settledBatchButton);
   
}

   
/**
     * Activity launcher for txn details transactions.
     */

   
private void launchSettledBatchListIntent() {
       
ReportingDetails reportingDetails =
           
ReportingDetails.createReportingDetails();
        reportingDetails
.setBatchIncludeStatistics(true);

        launchSubActivity
(authNetObj.createReportingSettledBatchListIntent(
               
this, reportingDetails),
                createBatchListReportingIntentResultCallback
());
   
}

   
/**
     * Creates a txn details Intent ResultCallback.
     *
     * @return ResultCallback
     */

   
/**
     * Creates a reporting intent ResultCallback.
     *
     * @return ResultCallback
     */

   
private ResultCallback createBatchListReportingIntentResultCallback() {
       
return new SimpleActivity.ResultCallback() {

           
public void resultTransactionCanceled(Enum<?> txnType) {
                showAlert
((TransactionType)txnType + " canceled", );
           
}

           
public void resultTransactionFailed(Enum<?> txnType, Result result) {
               
MessageType msgType = MessageType.E00000;
               
StringBuilder errorBuilder =
                   
new StringBuilder(msgType.getValue()).append(": ")
                   
.append(msgType.getText());

               
if(result.getMessages().size() > 0) {
                    errorBuilder
= new StringBuilder();
                   
for(MessageType msgType1 : result.getMessages()) {
                        errorBuilder
.append(msgType1.getValue()).append(": ")
                       
.append(msgType1.getText()).append("\n");
                   
}
               
}
                showAlert
((TransactionType)txnType + " error",
                    errorBuilder
.toString());
           
}

           
public void resultTransactionSucceeded(Enum<?> txnType, Result result) {
               
StringBuilder responseBuilder = new StringBuilder();
                net
.authorize.reporting.Result transactionResult =
                   
(net.authorize.reporting.Result)result;
               
if(transactionResult != null) {
               
for(BatchDetails batchDetail :
                    transactionResult
.getReportingDetails().getBatchDetailsList()) {
                    responseBuilder
.append("Batch id: ");
                    responseBuilder
.append(batchDetail.getBatchId())
                    responseBuilder
.append("\n");
                   
// set this for subsequent tests in the Reporting dialog.
                    responseBuilder
.append("Settlement state: ");
                    responseBuilder
.append(batchDetail.getSettlementState());
                    responseBuilder
.append("\n");
                    responseBuilder
.append("Settlement time (local): ");
                    responseBuilder
.append(batchDetail.getSettlementTimeLocal());
                    responseBuilder
.append("\n");
                    responseBuilder
.append("Settlement time (UTC): ");
                    responseBuilder
.append(batchDetail.getSettlementTimeUTC());
                    responseBuilder
.append("\n");
                    responseBuilder
.append("Payment method: ");
                    responseBuilder
.append(batchDetail.getPaymentMethod());
                    responseBuilder
.append("\n");
                   
for(BatchStatistics batchStat :
                        batchDetail
.getBatchStatisticsList()) {
                        responseBuilder
.append("        Account type: ");
                        responseBuilder
.append(batchStat.getAccountType());
                        responseBuilder
.append("\n");
                        responseBuilder
.append("        Charge amount: ");
                        responseBuilder
.append(batchStat.getChargeAmount());
                        responseBuilder
.append("\n");
                   
}
                    responseBuilder
.append("=========================\n");
               
}
               
}

                showAlert
((TransactionType)txnType + " success",
                          responseBuilder
.toString());
           
}
       
};
   
}

   
/**
     * Create a simple alert dialog.
     *
     * @param title
     * @param message
     */

   
private void showAlert(String title, String message) {
       
AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
.setMessage(message).setTitle(title)
           
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
               
public void onClick(DialogInterface dialog, int id) {}
           
});
        builder
.create().show();
   
}
}


Documentation

XML Show Samples Documentation (PDF)

GetSettledBatchList

This function returns information about a settled batch: Batch ID, Settlement Time, & Settlement State. If you specify includeStatistics, you also receive batch statistics by payment type.

REQUEST
RESPONSE

GetTransactionList

This function returns limited transaction details for a specified batch ID.

REQUEST
RESPONSE

GetTransactionDetails

This function returns full transaction details for a specified transaction ID.

REQUEST
RESPONSE

GetUnsettledTransactionList

This function returns limited transaction details for unsettled transactions.

REQUEST
RESPONSE

GetBatchStatistics

This function returns batch statistics by payment type for a specified batch ID.

REQUEST
RESPONSE

SOAP Show Samples Documentation (PDF)

GetSettledBatchList

This function returns information about a settled batch: Batch ID, Settlement Time, & Settlement State. If you specify includeStatistics, you also receive batch statistics by payment type.

REQUEST
RESPONSE

GetTransactionList

This function returns limited transaction details for a specified batch ID.

REQUEST
RESPONSE

GetTransactionDetails

This function returns full transaction details for a specified transaction ID.

REQUEST
RESPONSE

GetUnsettledTransactionList

This function returns limited transaction details for unsettled transactions.

REQUEST
RESPONSE

GetBatchStatistics

This function returns batch statistics by payment type for a specified batch ID.

REQUEST
RESPONSE