All "list" type API methods support a few functions to help prepare or navigate the list.

These functions are:

  1. Pagination
  2. Sorting
  3. Filtering

Pagination

To do pagination, you will need to set these variables.

Page Size

Page Number

Number of objects to be returned in a page.

The page number you want returned.

When you make the API call, include page[size]= and page[number]= to set the variables above.

GET api/v4/payments?page[number]=3&page[size]=100

Note

Default page size: 10
Max page size: 1000

Sorting

Sorting allows you to sort lists according to one or more criteria fields, for example, you might want to sort based on the createdAt date time.

If you do not sort, lists are typically retrieved as descending order, with the latest objects listed first.

To sort, pass in a ?sort= as part of the call.

When you pass in a sort field, the sort order will be in ascending order.
If you need to sort by descending order for a sort field, prefix the sort field parameter with a minus.

See the example below, where we want to list disbursements with the latest disbursements shown first.

GET api/v4/disbursements?sort=-createdAt

Filtering

Each list type API method will have its own specific filtering methods.
Please find their filtering methods in the specific API sections.

Here is an example of how to filter a list response:

GET api/v4/disbursements?filter[createdAfter]=2020-08-18T15:38:12+08:00

For timestamps, please note that when you send the request, the timestamp should be url-encoded like this:

GET api/v4/disbursements?filter[createdAfter]=2020-08-18T15%3A38%3A12%2B08%3A00

For listing of payments and disbursements, these are the filters you can use:

Filter Name

Type

Description

createdAfter

timestamp

State the time in Time.iso8601

createdBefore

timestamp

State the time in Time.iso8601

status

string

Disbursement Statuses: 'processing', 'completed', or 'failed'

Payment Statuses: "paid", "completed"

referenceId

string

State the specific referenceId if any.