Pagination
List endpoints (payment intents, payment links, refunds, settlements, events) return a list object. Paginate forward with a cursor, not page numbers, so results stay stable while new records are created.
List shape
Every list response has object: "list" and a data array of the most recent records first.
{
"object": "list",
"data": [
{ "id": "pi_live_3", "object": "payment_intent", "status": "paid" },
{ "id": "pi_live_2", "object": "payment_intent", "status": "expired" }
]
}Parameters
| Parameter | Meaning |
|---|---|
limit | How many records to return, 1 to 100 (a few endpoints allow up to 200). Each endpoint has its own default. |
starting_after | A record id. Returns the page of records that come after it. Omit it for the first page. |
Walk every page
Pass the id of the last record you received as starting_after on the next call. When a page returns fewer than limit records, you have reached the end.
# first page
curl "https://api.mavunta.com/v1/payment-intents?limit=100" \
-H "Authorization: Bearer cwk_live_sk_..."
# next page: start after the last id from the previous response
curl "https://api.mavunta.com/v1/payment-intents?limit=100&starting_after=pi_live_2" \
-H "Authorization: Bearer cwk_live_sk_..."import { Mavunta } from '@mavunta/sdk'
const mavunta = new Mavunta({ secretKey: process.env.MAVUNTA_SECRET_KEY! })
let startingAfter: string | undefined
for (;;) {
const page = await mavunta.paymentIntents.list({ limit: 100, starting_after: startingAfter })
for (const intent of page.data) {
// process intent
}
if (page.data.length < 100) break // last page
startingAfter = page.data[page.data.length - 1].id
}Cursors are ids, so they keep working even as new records arrive between calls. There are no page numbers or offsets.