diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tools/monthlyrevenue.py b/tools/monthlyrevenue.py new file mode 100644 index 000000000..9472eeda6 --- /dev/null +++ b/tools/monthlyrevenue.py @@ -0,0 +1,19 @@ +from app import stripe + +EXCLUDE_CID = {'cus_2iVlmwz8CpHgOj'} + +offset = 0 +total_monthly_revenue = 0 + +batch = stripe.Customer.all(count=100, offset=offset) +while batch.data: + for cust in batch.data: + if cust.id not in EXCLUDE_CID and cust.subscription: + sub = cust.subscription + total_monthly_revenue += sub.plan.amount * sub.quantity + offset += len(batch.data) + batch = stripe.Customer.all(count=100, offset=offset) + +dollars = total_monthly_revenue / 100 +cents = total_monthly_revenue % 100 +print 'Monthly revenue: $%d.%02d' % (dollars, cents)