Is it possible to query for datetime ranges with the Stripe API?

Question!

Using the Stripe API, I'd like to be able to query for date ranges or, failing that, dates that are greater than or less than some arbitrary date.

I know that I can query for something based on an exact date, e.g.,:

https://api.stripe.com/v1/events?created=1336503409

But I want something along the lines of...

# Search for events where `created` is greater than the epoch time: 1336503400
https://api.stripe.com/v1/events?created__gt=1336503400 
By : Chris W.


Answers

Along the same lines. You can achieve the same thing with the Python client like so:

import stripe
from datetime import datetime, timedelta

my_date = '1/31/2011'
my_timestamp = datetime.strptime(my_date, "%m/%d/%Y").timestamp()


stripe.Charge.all(created={'lt': my_timestamp})


This video can help you solving your question :)
By: admin