# Pagination

> List payments page by page with cursors, or let the SDK page for you.

`GET /v1/payments` returns newest first, one page at a time, using a **cursor**.

| Parameter | Meaning |
| --- | --- |
| `limit` | 1–100, default 20. |
| `starting_after` | A payment id: return the payments after it. Use the previous page's `next_cursor`. |

```json
{ "object": "list", "data": [ … ], "has_more": true, "next_cursor": "9d1f4c3e-…" }
```

Repeat with `starting_after=<next_cursor>` until `has_more` is `false`. You can combine paging with `status`, `external_id`, `created_from` and `created_to`.

## With the SDK

One page:

```js
const page = await devzity.payments.list({ limit: 20 })
console.log(page.data, page.hasMore, page.nextCursor)
```

Or iterate everything (pages are fetched lazily):

```js
for await (const payment of devzity.payments.listAutoPaging({ status: "PAID" })) {
  console.log(payment.id)
}
```
