Skip to content

Instantly share code, notes, and snippets.

@adamjstevenson
Last active October 6, 2015 14:12
Show Gist options
  • Save adamjstevenson/250cc4aed818acec2978 to your computer and use it in GitHub Desktop.
Save adamjstevenson/250cc4aed818acec2978 to your computer and use it in GitHub Desktop.
Iterate through Stripe charges in Python
import stripe
# Be sure to use your API key - https://dashboard.stripe.com/account/apikeys
stripe.api_key = "sk_your_secret_key"
charges = stripe.Charge.all(limit=100)
for charge in charges.data:
print(charge.id)
while charges.has_more:
charges = stripe.Charge.all(limit=100, starting_after=charges.data[-1])
for charge in charges.data:
print(charge.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment