Batches

This section describes the resource used to manage batches.

List

Method: GET

Url: https://api.thesecuregateway.com/rest/v1/batches

Filter fields

Name Format Description Default
page_size N Limits the number of batches returned by this method. Sometimes called "limit." Maximum is 100. 25
page N Specifies which page of results is returned. Page index starts at '1'. Ex: if page = 2 and pageSize = 50, then this method will return batches 51 - 100 (or the maximum batches available). If no batches exist in this range, then a blank list is returned. 1
order_by A Specifies which field to sort the batch list by. Field names are case sensitive. See "Other Fields" list below for valid fields. id
descending A Specifies which direction to sort the batch list by. Valid values are true and false. true
start_date A/N Filters the batches list by the settled date / time. Setting start_date will return batches that were settled after this date / time. Setting both start_date and end_date creates a range. See the "Valid Date / Time Formats" list below.
end_date A/N Filters the batches list by the settled date / time. Setting end_date will return batches that were settled before this date / time. Setting both start_date and end_date creates a range. See the "Valid Date / Time Formats" list below.
Valid Date / Time Formats

  • MM-dd-yyyy hh:mm a
  • MM-dd-yy HH:mm
  • MM-dd-yy HH:mm z
  • yyyy-MM-dd HH:mm
  • yyyy-MM-dd HH:mm z

Other Fields

Other fields available for filtering are: id, amount, type, result, last_four, authorization_code, invoice, order_id, first_name, last_name. See the Full Fields List for field details.

GET /rest/v1/batches?page_size=2 HTTP/1.1
Host: api.thesecuregateway.com
Accept: application/json
api_key: fc594b6c6fd4493db932d7ae50f8c56e
HTTP/1.1 200 OK
Content-Type: application/json
[ {
  "id" : "2",
  "refund_count" : "0",
  "refund_total" : "0.00",
  "sales_count" : "4",
  "sales_total" : "1743.63",
  "net_amount" : "1743.63",
  "status" : "OPEN",
  "total_count" : "4"
}, 
{
  "id" : "1",
  "confirmation_code" : "000000",
  "refund_count" : "1",
  "refund_total" : "844.97",
  "sales_count" : "3",
  "sales_total" : "1936.19",
  "net_amount" : "1091.22",
  "settled" : "2012-09-17T10:44:16.860-05:00",
  "status" : "CLOSED",
  "total_count" : "4"
} ]
HTTP/1.1 204 No Content

Get Open Batch

Method: GET

Url: https://api.thesecuregateway.com/rest/v1/batches/open

GET /rest/v1/batches/open HTTP/1.1
Host: api.thesecuregateway.com
Accept: application/json
api_key: fc594b6c6fd4493db932d7ae50f8c56e
HTTP/1.1 200 OK
Content-Type: application/json
{
  "id" : "2",
  "refund_count" : "0",
  "refund_total" : "0.00",
  "sales_count" : "4",
  "sales_total" : "1743.63",
  "net_amount" : "1743.63",
  "status" : "OPEN",
  "total_count" : "4"
}
HTTP/1.1 204 No Content

Close Open Batch

Method: PUT

Url: https://api.thesecuregateway.com/rest/v1/batches/open

PUT /rest/v1/batches/open HTTP/1.1
Host: api.thesecuregateway.com
Accept: application/json
api_key: fc594b6c6fd4493db932d7ae50f8c56e
HTTP/1.1 200 OK
Content-Type: application/json
{
  "id" : "1",
  "confirmation_code" : "000000",
  "refund_count" : "1",
  "refund_total" : "844.97",
  "sales_count" : "3",
  "sales_total" : "1936.19",
  "net_amount" : "1091.22",
  "settled" : "2012-09-17T10:44:16.860-05:00",
  "status" : "CLOSED",
  "total_count" : "4"
} 
HTTP/1.1 204 No Content

Response Fields

Name Format Description
id A/N The Secure Gateway unique batch ID.
status A The batch's current status. Value may be:
  • OPEN
  • CLOSED
There can be only one open batch at a time.
refund_count N Total number of refund (Matched and Unmatched) transactions included in this batch. Voided transactions are not counted.
refund_amount N The total, in USD, of all refund transactions included in this batch. Voided transactions are not counted.
sales_count N Total number of sale (SALE, FORCED SALE, CAPTURE) transactions included in this batch. Voided transactions are not counted.
sales_amount N The total, in USD, of all sale (SALE, FORCED SALE, CAPTURE) transactions included in this batch. Voided transactions are not counted.
total_count N Total number of all transactions included in this batch. Voided transactions are not counted.
total_amount N The total, in USD, of all transactions included in this batch. Voided transactions are not counted.
settled Date Represents the date / time that this batch was closed for settlement.
confirmation_code N The batch close confirmation code.