20 lines
559 B
Python
20 lines
559 B
Python
|
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)
|