Get Batch History API Overview

An overview of the Get Batch History API

As you settle transaction batches, the gateway keeps a history of previously closed transactions. The Get Batch History API allows you to see this history by letting you specify a date range that pulls batches closed within those dates. If you don't specify dates, the API returns all batches closed within the last three months.

📘

Important Note

You need to specify the date range within the endpoint URL, with dates formatted as yyyy-MM-dd. For example, api/v1/batches/history/2022-11-09/2022-11-16.

After providing your credentials, you can access the Get Batch History API through the following endpoint:

OperationEndpoint PathMethod
Get Batch Historyapi/v1/batches/history/{from}/{to}GET

Here is a simple example of how to use the API:

// Import libraries
using System.Net.Http.Headers;

// Initiate HTTP client
HttpClient client = new HttpClient();

// Set dates of the history to pull
string begin = new DateTime(2024, 6, 9).ToString("yyyy-MM-dd");
string end = new DateTime(2024, 6, 16).ToString("yyyy-MM-dd");
// Set API endpoint
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://cert-proc.precisionpay.com/api/v1/batches/history/" + begin + "/" + end);

// Set headers
request.Headers.Add("accept", "*/*");
// Set merchant number
request.Headers.Add("MerchantNbr", "ENTER YOUR MERCHANT NUMBER");
// Set Username
request.Headers.Add("Username", "ENTER YOUR USERNAME");
// Set password
request.Headers.Add("Password", "ENTER YOUR PASSWORD");

// Call endpoint
HttpResponseMessage response = await client.SendAsync(request);
// Store response
string responseBody = await response.Content.ReadAsStringAsync();

// Print response
Console.WriteLine(responseBody);
# Import libraries
import requests, json, datetime

# Set authentication
MERCHANTNBR = 'ENTER YOUR MERCHANT NUMBER'
USERNAME = 'ENTER YOUR USERNAME'
PASSWORD = 'ENTER YOUR PASSWORD'

# Set dates of the history to pull
begin = datetime.datetime(2024, 6, 9).strftime('%Y-%m-%d')
end = datetime.datetime(2024, 6, 16).strftime('%Y-%m-%d')
# Set endpoint
endpoint = 'https://cert-proc.precisionpay.com/api/v1/batches/history/' + begin + '/' + end

# Set headers
HEADERS = {
    'accept': '*/*',
    'MerchantNbr': MERCHANTNBR,
    'Username': USERNAME,
    'Password': PASSWORD,
    'Content-Type': 'application/json',
}

# Call endpoint
response = requests.get(endpoint, headers=HEADERS).json()

# Print response
print(json.dumps(response, indent=4))
// Set authentication
const merchantNbr = 'ENTER YOUR MERCHANT NUMBER';
const username = 'ENTER YOUR USERNAME';
const password = 'ENTER YOUR PASSWORD';

// Set dates of the history to pull
begin = new Date(2024, 6, 9).toJSON().substr(0, 10);
end = new Date(2024, 6, 16).toJSON().substr(0, 10);
// Set endpoint
const endpoint = 'https://cert-proc.precisionpay.com/api/v1/batches/history/' + begin + '/' + end;

// Set headers
const header = {
    'accept': '*/*',
    'MerchantNbr': merchantNbr,
    'Username': username,
    'Password': password,
    'Content-Type': 'application/json',
}

// Call endpoint
fetch(endpoint, {
    method: 'GET',
    headers: header,
})
    // Get response
    .then(response => response.text())
    // Print response
    .then(data => console.log(data));