Admia
Admia

Reputation: 1144

why stripe.Charge.list retrieves up to only 100 charges?

I use the following code to retrieve all the charges:

charges=stripe.Charge.list(limit=10000)

But the code retrieves only up to 100 charges. Why?

Upvotes: 0

Views: 696

Answers (1)

Barmar
Barmar

Reputation: 780663

From the Stripe documentation

limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

If you specify a limit more than 100, it caps it at 100.

You need to call it repeatedly to get the next group. Use the starting_after option for subsequent calls:

A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

Upvotes: 2

Related Questions