From 0d0ac728ebb09d26ba001471471ae7710b02e56d Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Sun, 17 Nov 2013 00:45:56 -0500 Subject: [PATCH] StripeController: handle exception when customer isn't found. --- r2/r2/controllers/ipn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/ipn.py b/r2/r2/controllers/ipn.py index 0d809a8e0..f1383c880 100644 --- a/r2/r2/controllers/ipn.py +++ b/r2/r2/controllers/ipn.py @@ -767,8 +767,11 @@ class StripeController(GoldPaymentController): # there's no associated account - delete the subscription # to cancel the charge g.log.error('no account for stripe invoice: %s', invoice) - customer = stripe.Customer.retrieve(customer_id) - customer.delete() + try: + customer = stripe.Customer.retrieve(customer_id) + customer.delete() + except stripe.InvalidRequestError: + pass elif status == 'invoice.payment_failed': invoice = event.data.object customer_id = invoice.customer