ListPaymentsRequest pagination

HI,

Using the latest Api (2025-04-16), considering I have an infinite number of payments. I would like to retrieve payments using a cursor so clients would be able to request payments, pages by page by calling a new request ( with relevant cursor) — As I did in older api versions.

How using, the new version call, can I retrieve a limited set of payments without using the pager or without retrieving the whole set of payments?

It seams the request is returning the whole set of payments every time? I am wrong?
Thanks

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Take Payments
Take Payments
Payments API

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

In the latest API version, you can still use pagination to retrieve a limited set of payments. When you call the ListPayments endpoint, you can specify a limit parameter to control the number of payments returned in each response. If there are more payments to retrieve, the response will include a cursor that you can use in your next ListPayments request to fetch the next set of payments. If there are no more payments to retrieve, the response will not include a cursor.

So, if you’re seeing all payments returned in a single response, it might be because you’re not setting a limit, or the total number of payments is less than or equal to the limit you’ve set.

Remember to use the cursor returned in the previous response in your subsequent ListPayments request to retrieve the next set of payments.

This answer was reviewed by @Bryan-Square.

Thanks.
Following the successful request, the object returned ti a Square\Core\Pagination\CursorPager, how to get the cursor from it, it does not have the getCursor() function

I have over 300 payments, I set limit : 50, I know I have 6 pages doing
$pageCount = 0;
foreach ($apiResponse->getPages() as $page) {
$pageCount++;
}
I don’t find how to get the cursor.

I see using the Api Explorer it returns a json with payments and at the end a cursor. But from the api, I get the pager which does not seam to have the payload structure I look for.

Thanks.

Confirmed by Square Support, Square\Core\Pagination\Page::getCursor() is not supported on square/square-php-sdk Version 42.1.0.20250416. It is quite unfortunate the online documents is not reflecting this.