From c410e2cbc5fe889e606f5d88eb1389c65025ef21 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 3 Oct 2017 21:35:08 +0530 Subject: [PATCH] stripe_customer_id retrieved from request.user relation --- hosting/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index f6a64ad3..f0afb0c8 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -746,7 +746,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, def post(self, request): template = request.session.get('template') specs = request.session.get('specs') - stripe_customer_id = request.session.get('customer') + # We assume that if the user is here, his/her StripeCustomer + # object already exists + stripe_customer_id = request.user.stripecustomer.id billing_address_data = request.session.get('billing_address_data') vm_template_id = template.get('id', 1) stripe_api_cus_id = self.request.session.get('customer')