Pagination

Many top-level API resources support bulk fetches through "list" methods. Every list method returns its results in an items array and accepts an optional pageSize parameter indicating how many results to return per page.

Beyond that, two paging styles are used. Check which one applies to the endpoint you are calling.

Style
Endpoints
GET /customers
GET /payment-links
GET /payment-methods
GET /payments/search
GET /refunds/search
GET /settlements
GET /settlements/{settlementId}/reconciliation

Page number paging

Request the page you want directly.

Parameters

  • pageNumber: the page to return. Defaults to 1.
  • pageSize: how many results to return per page.

Response

  • items: the results for this page.
  • totalCount: the total number of records matching your filters, across all pages. This is not the number of records in items.
  • pageInfo: an object describing the current position:
    • currentPage: the page you requested.
    • lastPage: the final page number available.
    • pageSize: the size of the page returned.
    • hasNextPage: whether another page follows.
{
  "pageInfo": {
    "hasNextPage": true,
    "currentPage": 1,
    "lastPage": 4,
    "pageSize": 100
  },
  "totalCount": 312,
  "items": []
}

To page through results, increment pageNumber until hasNextPage is false.

Cursor paging

Follow a token returned with each page. Use this when results may change while you are paging, as cursors are not affected by records being added or removed between requests.

Parameters

  • page: the cursor token from the nextPage property of a previous response. Omit it to get the first page.
  • pageSize: how many results to return per page.

Response

  • items: the results for this page.
  • nextPage: an optional token to pass as page on your next request.
  • hasNext: whether another page follows.
  • pageSize: the size of the page returned. This does not have to equal the number of records in items — a page size of 10 may return only 5 records on the final page.
{
  "pageSize": 25,
  "nextPage": "eyJwYWdlIjoyfQ",
  "hasNext": true,
  "items": []
}

To page through results, repeat the request passing nextPage as page until hasNext is false.

📘

Totals are only available with page number paging

Cursor endpoints do not return a totalCount. If you need to know how many records match before you start paging, use a page number endpoint.