Skip to content
Merxian

Technical concepts

Pagination and filters

List endpoints return one page at a time, newest first. To read the next page, send the cursor from the previous response.

On this page

The page model#

A list response has two fields:

A page
{
  "data": [{ "id": "txn_0F8mQ2rXbT4kL9pZa" }],
  "pagination": { "nextCursor": "eyJpZCI6InR4bl8wRjhtUTJyWGJUNGtMOXBaYSJ9" }
}
  • data holds the resources of the page, newest first.
  • pagination is always present. pagination.nextCursor is the cursor of the next page. On the last page, nextCursor is absent and pagination is {}.

There is no total count and no page number.

Parameters#

Parameter Description
limit How many resources to return, from 1 to 100. The default is 20. A value outside this range returns 400.
cursor The nextCursor of the previous page. Omit it for the first page.

A cursor is opaque. Do not build or change one. A cursor that is not valid returns 400. Send the same filters with each page as with the first page.

Endpoints that paginate#

Endpoint Filters
List transactions status, customerId, fromDate, toDate
List checkout sessions status
List payment links None

List the payments of a transaction is not paginated. It returns a plain JSON array.

Filters#

On List transactions:

  • status keeps transactions in one state, for example completed. An unknown value returns 400.
  • customerId keeps transactions of one customer.
  • fromDate keeps transactions created at or after an ISO 8601 instant. It is inclusive.
  • toDate keeps transactions created before an ISO 8601 instant. It is exclusive.

To read one day, use fromDate=2026-09-14T00:00:00Z and toDate=2026-09-15T00:00:00Z.

On List checkout sessions, status keeps sessions in one state, for example complete.

Read every page#

This loop reads every completed transaction. It is an example for Node.js 18 or later, not an SDK.

list-all.ts
async function listCompletedTransactions(): Promise<unknown[]> {
  const all: unknown[] = []
  let cursor: string | undefined
  do {
    const query = new URLSearchParams({ status: 'completed', limit: '100' })
    if (cursor !== undefined) query.set('cursor', cursor)
    const response = await fetch(`https://api.merxian.com/v1/transactions?${query}`, {
      headers: { Authorization: `Bearer ${process.env.MERXIAN_API_KEY}` },
    })
    if (!response.ok) throw new Error(`List failed with status ${response.status}`)
    const page = await response.json()
    all.push(...page.data)
    cursor = page.pagination.nextCursor
  } while (cursor !== undefined)
  return all
}

Resources can be created while you page. A new resource appears at the start of the list, so a loop that started before it does not return it. Use fromDate and toDate to read a fixed period.

Try refund, payment.succeeded,POST /v1/transactions, orIdempotency-Key.