@ -170,6 +170,10 @@ class StripeBackend(BackendBase):
)
except self.stripe.error.InvalidRequestError:
return
except self.stripe.CardError as e:
subscr.status = 'error'
subscr.backend_data['stripe_error'] = e.json_body['error']['message']
try:
if subscr.status == 'new':
@ -126,6 +126,12 @@ def callback_stripe_subscr(request, id):
p = Subscription.objects.get(id=id)
BACKENDS['stripe'].callback_subscr(p, request)
if p.status == 'error' or p.status == 'cancelled':
messages.add_message(request, messages.ERROR,
_("Error subscribing. It usually means you don't"
" have enough money available."))
else:
messages.add_message(request, messages.INFO, _("Subscribed!"))
return redirect(reverse('account:index'))