Pagination

List endpoints in the Orbi Payments Gateway API use page-based pagination. Pagination allows you to retrieve large result sets in smaller, predictable chunks.

In addition to pagination, list endpoints support sorting by creation time.


Request parameters

Use the following query parameters when listing resources:

  • page (integer, optional) — The page number to retrieve. Defaults to 1.
  • limit (integer, optional) — The maximum number of items returned per page. Defaults to 10. Must be between 1 and 100.
  • sort (string, optional) — Sort order by creation date (created_at). Defaults to desc (newest first).
    • asc — Oldest first
    • desc — Newest first

Example

curl -X GET "https://sandbox.orbipayments.com/v1/orders?page=1&limit=25&sort=desc" \
  -H "x-api-key: ak_sandbox_xxxxx..."

Sorting behavior

Results are sorted by the resource creation timestamp (createdAt):

  • sort=desc returns the newest records first
  • sort=asc returns the oldest records first

If sort is not provided, the API defaults to desc.


Response shape

Paginated responses include both the list of items and pagination metadata:

FieldTypeDescription
itemsarray<T>Items returned in the current page.
limitnumberMaximum number of items per page.
countnumberNumber of items returned in the current page.
totalnumberTotal number of matching items across all pages.
pagenumberCurrent page number.
totalPagesnumberTotal number of pages available.

Example response

{
  "items": [
    {
      "id": "ord_123",
      "status": "awaiting_payment",
      "createdAt": "2025-12-16T02:23:00.000Z"
    }
  ],
  "limit": 25,
  "count": 1,
  "total": 42,
  "page": 1,
  "totalPages": 2
}

Best practices

  • Stop iterating when page >= totalPages.
  • count may be less than limit on the last page.
  • Prefer sort=desc for user-facing feeds (newest-first) unless you have a specific reason to process oldest-first.

Example: Fetch all pages (pseudo-code)

let page = 1;
const limit = 100;

while (true) {
  const res = await listOrders({ page, limit, sort: "desc" });

  for (const item of res.items) {
    // process item
  }

  if (page >= res.totalPages) break;
  page += 1;
}

Did this page help you?