require 'stripe'
Stripe.api_key = "sk_example"
# Get the first 100 charges. Use limit => 100 to change the default value from 10 to 100
charges = Stripe::Charge.all(:limit => 100)
# Print the charge ID for each one
charges.each do |charge|
puts charge.id
end
# If there are more than 100 charges, paginate through each set of 100
while charges.has_more do
charges = Stripe::Charge.all(:limit => 100, :starting_after => charges.data.last.id)
charges.each do |charge|
puts charge.id
end
end