NowgateDocs

Pagination

Lists are newest first and page by ID. Walk them one page at a time, or let the SDKs walk every page.

On this page

Every list (payments, payment links, payouts, payout destinations, batches and refunds) is newest first and answers one page:

{ "object": "list", "data": [{ "id": "pay_…" }, { "id": "pay_…" }], "has_more": true }
ParameterWhat
limitItems per page: 20 by default, at most 100.
starting_afterAn ID from the previous page: the page of older items after it.
ending_beforeAn ID: the page of newer items before it.

Plus each list's filters, such as a payment's status or order_id. has_more says whether there is another page. Pages are by ID, so items created while you walk neither repeat nor shift your walk: newer items appear in a new walk.

const walked: string[] = [];
let page = await nowgate.payments.list({ limit: 2 });
walked.push(...page.data.map((p) => p.id));
while (page.has_more) {
  page = await nowgate.payments.list({ limit: 2, starting_after: page.data.at(-1)?.id });
  walked.push(...page.data.map((p) => p.id));
}

Every page#

listAll (list_all in Python) walks every page for you, newest first, asking for 100 items at a time unless you give a limit, and follows starting_after while has_more is true. It fetches nothing until you iterate, stops when you do, and retries each page as any GET.

const all: string[] = [];
for await (const each of nowgate.payments.listAll()) all.push(each.id);