Batches

Batches Overview

With the exception of Pre-Authorizations, an accepted (non-declined, non-error) transaction belongs to a batch, which is accessible via the API as an identifiable resource. An originator can only have one open batch at a time. An open batch can be closed via the API, or it can be auto-closed according to Gateway and/or merchant account settings.

Closing a Batch

A request to close the open batch is submitted to the Clearent Payment Gateway using the HTTP PUT method, with a URL in the following form:

https://gateway-sb.clearent.net/rest/v2/batches/open

TIP: Depending on the batch size, a batch can take up to 90 seconds to close. If your batches are really large consider batching out more often, or setting your timeout higher.

Fetching a Batch

Requests for batch information are submitted to the Clearent Payment Gateway using the HTTP GET method, with a URL in the following form:

https://gateway-sb.clearent.net/rest/v2/batches

To see the contents of the open batch, specify the “open” resource:

https://gateway-sb.clearent.net/rest/v2/batches/open

The following fields can be specified as part of the query string appended to the URL, e.g.: GET /rest/v2/batches?page_size=10&page=3

Field Name Description
page-size Numeric

Default: 25

Limits the number of batches returned by this method. Sometimes called “limit.” Maximum is 100.

page Numeric

Default: 1

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.

descending Alpha

Default: true

Specifies which direction to sort the batch list by. Valid values are true and false.

start-date Alpha-numeric

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 Alpha-numeric

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 formats for the “start-date” and “end-date” fields include the following:

• 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

Batch Responses: Get Open Batch

Get Open Batch Request

Allows you to retrieve an open batch.

Method: GET

URL: https://gateway-sb.clearent.net/rest/v2/batches/open

REQUEST

GET /rest/v2/batches/open HTTP/1.1

Host: gateway-sb.clearent.net

accept: application/xml

api-key: YOURAPIKEY

Get Open Batch Response

XML

JSON

Batch Responses: Close Open Batch

Close Open Batch

Allows your software to manually close a batch. Clearent can also set up at the account level the ability to auto close the batch daily. For early merchant funding, batches need to close no later than 11 pm Eastern Time. To ensure your batch processes to meet this time frame, we recommend closing the batch by 10:45 pm Eastern Time to allow time for processing.

Close Open Batch Request

Method: PUT

URL: https://gateway-sb.clearent.net/rest/v2/batches/open

REQUEST

PUT /rest/v2/batches/open HTTP/1.1

Host: gateway-sb.clearent.net

Accept: application/xml

api-key: YOURAPIKEY

Close Open Batch Response

XML

JSON