Close Batch API Overview

An overview of the Close Batch API

With the Close Batch API, you can close the currently open batch and settle all approved transactions within it. As you can only have a single batch open at any given time for a merchant, the execution of this operation only requires the authentication information in the request header.

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

OperationEndpoint PathMethod
Close Batchapi/v1/batches/closePUT

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 API endpoint
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, "https://cert-proc.precisionpay.com/api/v1/batches/close");

// 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

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

# Set endpoint
ENDPOINT = 'https://cert-proc.precisionpay.com/api/v1/batches/close'

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

# Call endpoint
response = requests.put(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 endpoint
const endpoint = 'https://cert-proc.precisionpay.com/api/v1/batches/close';

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

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