Pagination and Cursors

As you continue to use your Paytron account, the number of items in it will grow. Eventually, you will no longer be able to fetch all of the data you need in a single request.

To make it possible for you to navigate lists of payments, bills and other Paytron resources, our list and search API endpoints support a cursor.

What is a cursor?

A cursor is like a bookmark to a specific piece of data, it contains the key information that tells our system where to pick up it's operation if you want to come back and fetch more records.

It works very similarly to a page number, with the key difference that cursors are unique to search or list operation you're performing. I.e. if you search for payments by a given status and receive a cursor, you can't use that cursor to search the same set of payments by payment date.

How to use cursors

When a list or search request detects that it has more results than it can return in a single response, you'll receive a cursor in the response body along with the data returned by that first request.

If you want to fetch more data, you can provide the cursor value you received in the previous call to the next call you make via the cursor query string parameter.

Example - List bills

Say we want to fetch all bills in a given account that require approval. You make a call that looks something like to the following URL:

Which would then return a response that looks like this:

 "data":[], // A list of bills in needs approval status 
 "cursor": "831630f6d588c361530d770a78dfac8a" // Your cursor may be longer than this 

The presence of the cursor field in the response indicates there are more bills awaiting approval than the endpoint could return in one call. To get the next batch of bills you simply call the same URL with the same search parameters, but this time add cursor along with the value returned to you in the previous call.

For the example above this one look as so: