Pagination
Endpoints that list resources (/user/transactions, /user/callbacks, /user/infractions) use classic pagination via page + limit with a hasNextPage flag.
Loop pattern
PAGE=1
LIMIT=100
while : ; do
RESP=$(curl -s "https://api.payzu.processamento.com/v1/user/transactions?dateFrom=2025-11-01&page=$PAGE&limit=$LIMIT" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json")
echo "$RESP" | jq -c '.data[]'
HAS_NEXT=$(echo "$RESP" | jq -r '.hasNextPage')
[ "$HAS_NEXT" != "true" ] && break
PAGE=$((PAGE+1))
doneasync function* iterateTransactions(filters: Record<string, string>) {
let page = 1;
const limit = 100;
while (true) {
const params = new URLSearchParams({ ...filters, page: String(page), limit: String(limit) });
const res = await fetch(`https://api.payzu.processamento.com/v1/user/transactions?${params}`, {
headers: {
Authorization: `Bearer ${process.env.PAYZU_TOKEN}`,
'Content-Type': 'application/json',
},
});
const { data, hasNextPage } = await res.json();
for (const tx of data) yield tx;
if (!hasNextPage) return;
page++;
}
}
for await (const tx of iterateTransactions({ dateFrom: '2025-11-01' })) {
await process(tx);
}def iterate_transactions(**filters):
page = 1
limit = 100
while True:
res = requests.get(
'https://api.payzu.processamento.com/v1/user/transactions',
params={**filters, 'page': page, 'limit': limit},
headers={
'Authorization': f'Bearer {os.environ["PAYZU_TOKEN"]}',
'Content-Type': 'application/json',
},
)
body = res.json()
for tx in body['data']:
yield tx
if not body.get('hasNextPage'):
return
page += 1func IterateTransactions(filters url.Values, fn func(tx Transaction) error) error {
page := 1
for {
filters.Set("page", strconv.Itoa(page))
filters.Set("limit", "100")
req, _ := http.NewRequest("GET",
"https://api.payzu.processamento.com/v1/user/transactions?"+filters.Encode(), nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("PAYZU_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil { return err }
var body struct {
Data []Transaction `json:"data"`
HasNextPage bool `json:"hasNextPage"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
res.Body.Close()
return err
}
res.Body.Close()
for _, tx := range body.Data {
if err := fn(tx); err != nil { return err }
}
if !body.HasNextPage { return nil }
page++
}
}Available filters
| Filter | When to use |
|---|---|
dateFrom / dateTo | Time window (ISO 8601). |
clientReference | Finds the transaction matching your order. |
virtualAccount | Filter by tenant (multi-store). |
status | CSV: COMPLETED,PENDING. Accepts multiple values. |
type | CSV: DEPOSIT,WITHDRAW,COMMISSION. |
endToEndId | Unique Bacen identifier. |
document, name | Payer filters. document digits only (11 or 14). |
amount | Filter by exact amount. |
Page size and limit
| Item | Value |
|---|---|
limit max | 100 per page |
| Default | 20 |
Oversized pages degrade latency. If you need a long period (month, year) or to export everything, prefer the asynchronous report.
When to use the asynchronous report instead of paginating
| Scenario | Recommendation |
|---|---|
| On-screen listing (dashboard) | GET /user/transactions with pagination. |
| Single lookup | GET /user/transactions?clientReference=order-1234. |
| Daily reconciliation (< 10k transactions) | GET /user/transactions paginated. |
| Monthly/yearly reconciliation | POST /user/report (asynchronous CSV). |
| BI/Data Warehouse | POST /user/report run daily, ingested via ETL. |
The asynchronous report generates a CSV file with a signed download URL. It has no row limit and runs in the background. See the Reconciliation tutorial.
Common pitfalls
| Pitfall | Symptom |
|---|---|
Fetching everything without dateFrom on a high-volume account | Slow response, possible timeout |
limit=1000 (above the allowed maximum) | API rejects or truncates |
Iterating until data.length === 0 instead of hasNextPage | Infinite loop on the empty page after the last iteration |
Fixed page (page=1 always) | Only reads the first 100, misses the rest |
Passing document with punctuation (123.456.789-00) | 400 error, regex accepts digits only |
Lidando com callbacks
Responda em menos de 5 segundos, enfileire o processamento pesado, deduplique por id + status e teste localmente com ngrok. O retry da PayZu é robusto, mas só funciona se o seu handler se comportar bem.
Dinheiro e precisão
A PayZu Pix API usa reais com casas decimais, não centavos. Como armazenar internamente sem perder precisão, converter na borda e respeitar os limites mínimos de cada operação.