API Reference

Create a batch

POST/batches/{filename}

Batch File Format

The Batch File Format is detailed in the Overview section of the Batches Reference. There are three formats - Purchases, Refunds, Direct Debits.

Filename Convention

The Batch filename must fit a specific convention in order to be accepted. When uploading your batch please ensure that the filename uses the following pattern:

BATCH-[version]-[type]-[username]-[date]-[reference].csv

Where:

  • version is the file format version (currently v1)
  • type is the batch file type (PURCHASE, REFUND or DIRECTDEBIT)
  • username is your merchant username
  • date is the date in YYYYMMDD format when the batch should be processed
  • reference is your reference for the batch file

Body Parameters

RAW_BODYstring (binary)(optional)

The batch CSV file format

Query Parameters

filenamestring

Your CSV batch payments file name

Request

curl
curl https://gateway.pmnts-sandbox.io/v1.0/batches/BATCH-v1-PURCHASE-TEST-20180131-1516337064.csv \
  -u TEST:TEST \
  --data-binary @tmp/batches/BATCH-v1-PURCHASE-TEST-20180131-1516337064.csv \
  -H "Content-Type: text/csv" \

Response

201cURL
json
{
  "successful": true,
  "response": {
  "id": "071-BF-2H8VWBRN",
  "filename": "BATCH-v1-PURCHASE-TEST-20180131-1516337064.csv",
  "created_at": "2018-02-19T12:29:55+11:00",
  "process_date": "2018-01-31",
  "start_date": null,
  "completed_date": null,
  "status": "New",
  "type": "PURCHASE",
  "reference": "1516337064"
  },
  "errors": [],
  "test": false
}
201Ruby
json
{
  "id": "071-BF-NFIIDN7F",
  "filename": "BATCH-v1-PURCHASE-TEST-20180131-1516337065.csv",
  "created_at": "2018-02-19T12:36:20+11:00",
  "process_date": "2018-01-31",
  "start_date": null,
  "completed_date": null,
  "status": "New",
  "type": "PURCHASE",
  "reference": "1516337065"
}