Auto-pagination 

About the API
Pagination
Auto-pagination

Our libraries support auto-pagination. This feature allows you to easily iterate through large lists of resources without having to manually perform the requests to fetch subsequent pages.

To use the auto-pagination feature in Node 10+, simply iterate over a “list” call with the parameters you need in a for await loop.

To use the auto-pagination feature in older versions of Node, issue a “list” call with the parameters you need, then call autoPagingEach(onItem) on the returned list object to iterate over all objects matching your initial parameters.

Full docs are on the stripe-node GitHub repository.

const Stripe = require('stripe');
const stripe = Stripe('sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2');
// In Node 10+:
for await (const customer of stripe.customers.list({limit: 3})) {
// Do something with customer
}
// In other environments:
stripe.customers.list({limit: 3})
.autoPagingEach(function(customer) {
// Do something with customer
});