Skip to content

Reference

Pagination

List endpoints use cursors, never page numbers, so a list that changes while you read it neither repeats nor skips items.

A page
{
  "items": [ ... ],
  "next_cursor": "opaque-string-or-null"
}
  • Pass next_cursor back as cursor to get the next page. null means you reached the end.
  • limit is 1 to 100 and defaults to 50.
  • Cursors are opaque. Do not build, parse or store them for longer than the job that uses them, except the event cursor described below.
  • Keep the other query parameters (filters) the same while you follow a cursor.

curl

# First page, then pass next_cursor back as cursor until it is null.
curl -sS "$RAVELO_API/v1/payment-intents?limit=25" \
  -H "Authorization: Bearer $RAVELO_TEST_KEY"

curl -sS "$RAVELO_API/v1/payment-intents?limit=25&cursor=$NEXT_CURSOR" \
  -H "Authorization: Bearer $RAVELO_TEST_KEY"

TypeScript

import { Ravelo } from "@ravelo/sdk";

const ravelo = new Ravelo({ apiKey: process.env.RAVELO_TEST_KEY!, baseUrl: process.env.RAVELO_API! });

// Every succeeded payment, fetching pages as you go.
for await (const payment of ravelo.paymentIntents.listAll({ status: "succeeded", limit: 100 })) {
  console.log(payment.order_ref, payment.amount_received);
}

// Or one page at a time.
let cursor: string | undefined;
do {
  const page = await ravelo.paymentIntents.list({ limit: 25, cursor });
  console.log(page.items.length, "payments");
  cursor = page.next_cursor ?? undefined;
} while (cursor);

Python

import os

from ravelo import Ravelo

ravelo = Ravelo(os.environ["RAVELO_TEST_KEY"], os.environ["RAVELO_API"])

# Every succeeded payment, fetching pages as you go.
for payment in ravelo.payment_intents.list_all(status="succeeded", limit=100):
    print(payment["order_ref"], payment["amount_received"])

# Or one page at a time.
cursor = None
while True:
    page = ravelo.payment_intents.list(limit=25, cursor=cursor)
    print(len(page["items"]), "payments")
    cursor = page["next_cursor"]
    if not cursor:
        break

The SDKs have listAll() (TypeScript) and list_all() (Python), which follow the cursor for you.

Reading the event stream

GET /v1/events carries the same events your webhooks deliver, oldest first, for clients that poll or need to catch up after downtime. Keep next_cursor and pass it back later to receive only newer events. It is returned even when the page is empty, so a caught-up client keeps polling with it.

Events appear once every transaction that started before them has finished, so a late commit is never skipped. For browsing a log newest first use order=desc; pollers should keep the default order.

TypeScript

import { Ravelo } from "@ravelo/sdk";

const ravelo = new Ravelo({ apiKey: process.env.RAVELO_TEST_KEY!, baseUrl: process.env.RAVELO_API! });

// Catch up on events you missed, oldest first. Store the cursor after each page.
const page = await ravelo.events.list({ cursor: process.env.LAST_CURSOR, limit: 100 });
for (const event of page.items) console.log(event.type, event.id);
console.log("save this cursor:", page.next_cursor);

Paginated endpoints

EndpointWhat it lists
GET /v1/payment-intentsList payment intents, newest first
GET /v1/transactionsTransaction history
GET /v1/invoicesMonthly invoices
GET /v1/webhook-endpoints/{id}/deliveriesDeliveries to an endpoint, newest first
GET /v1/eventsAccount event stream by cursor