Batch Details

Overview

This page will show you how to get batch details. The API endpoints below can either get the merchant's current batch or a batch by its key. The response will show details about the batches status, relevant dates, and transaction details.

The API endpoints are as follows:

GET /api/v2/batches/current
GET /api/v2/batches/[batch_key]

Quick Start (Current)

Request

curl -X GET https://sandbox.usaepay.com/api/v2/batches/current
    -H "Content-Type: application/json"
    -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant who is trying to view the details of their current batch.

Response

{  
   "type":"batch",
   "key":"7t1sf8ysd1kzd1b",
   "opened":"2017-10-23 14:06:53",
   "status":"open",
   "scheduled":"2017-10-25 02:06:53",
   "total_amount":500,
   "total_count":8,
   "sales_amount":600,
   "sales_count":6,
   "voids_amount":100,
   "voids_count":1,
   "refunds_amount":100,
   "refunds_count":1
}

This is the sample response object sent back from the server.

Response Variables

Variable Type Description
type string The type of object returned. Should return a batch.
key integer Unique key for the batch
refnum integer Transaction reference number
opened date Date when the batch opened
status string Current status of the batch (open, closed, locked)
scheduled* date Date when the batch is set to automatically close
closed* date Date when the batch has closed
total_amount double The net amount in the batch
total_count integer The number of transactions in the batch
sales_amount* double The amount of sales in the batch
sales_count* integer The number of sales transactions in the batch
voids_amount* double The amount of voids in the batch
voids_count* integer The number of voids transactions in the batch
refunds_amount* double The amount of credits in the batch
refunds_count* integer The number of credits transactions in the batch

* Optional fields which appear when applicable

Batch details by key

Request

To get batch details by key:

curl -X GET https://sandbox.usaepay.com/api/v2/batches/at1ndcqnpvq64cw
    -H "Content-Type: application/json"
    -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant who is trying to view the details of a batch by its key.

{  
   "type":"batch",
   "key":"at1ndcqnpvq64cw",
   "opened":"2017-09-25 10:49:13",
   "status":"closed",
   "closed":"2017-09-26 09:16:19",
   "total_amount":433,
   "total_count":22,
   "sales_amount":462,
   "sales_count":7,
   "voids_amount":1112,
   "voids_count":14,
   "refunds_amount":29,
   "refunds_count":1
}

This is the sample response object sent back from the server.

Common Errors

Invalid batch key

If the batch key does not exist for your merchant, you will get the following response.

{  
   "error":"Invalid record locator key",
   "errorcode":47
}

Change Log

Date Change
2017-08-01 Added page.
2017-11-29 Added code examples to page.

Click here for the full REST API change log.