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 Ruby, simply issue an initial “list” call with the parameters you need, then call auto_paging_each on the returned list object to iterate over all objects matching your initial parameters.

require 'stripe'
Stripe.api_key = 'sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2'
customers = Stripe::Customer.list({limit: 3})
customers.auto_paging_each do |customer|
# Do something with customer
end