Support non-subscriptions in billing.

master
Nick Sergeant 2013-10-22 13:58:13 -04:00
parent ab7e9be51d
commit 95f56abcfe
1 changed files with 13 additions and 6 deletions

View File

@ -22,17 +22,24 @@ def stripe_account_details(request):
else:
stripe.api_key = STRIPE_SECRET_KEY
customer = stripe.Customer.retrieve(request.user.profile.stripe_id)
return {
data = {
'last4': customer.active_card.last4,
'created': customer.created,
'email': customer.email,
'amount': customer.subscription.plan.amount,
'interval': customer.subscription.plan.interval,
'name': customer.subscription.plan.name,
'status': customer.subscription.status,
'nextBill': customer.subscription.current_period_end,
}
if customer.subscription:
data['amount'] = customer.subscription.plan.amount
data['interval'] = customer.subscription.plan.interval
data['name'] = customer.subscription.plan.name
data['status'] = customer.subscription.status
data['nextBill'] = customer.subscription.current_period_end
else:
data['status'] = 'inactive'
return data
@login_required
@render_to('stats.html')