From 8d40a33882a143eb4d8206099c7167551e87726a Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Fri, 10 May 2024 23:20:20 +0800 Subject: [PATCH] Fixed stripe checkouts --- backend/payments/views.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/payments/views.py b/backend/payments/views.py index a7bf799..9dc6335 100644 --- a/backend/payments/views.py +++ b/backend/payments/views.py @@ -67,22 +67,18 @@ class StripeCheckoutView(APIView): }, status=status.HTTP_404_NOT_FOUND) # Get the stripe_price_id from the related StripePrice instances - PRICE = None - PRICE_ID = None - if annual: PRICE = SUBSCRIPTION.annual_price - PRICE_ID = PRICE.stripe_price_id else: PRICE = SUBSCRIPTION.monthly_price - PRICE_ID = PRICE.stripe_price_id # Return 404 if no price is set - if not PRICE or PRICE_ID: + if not PRICE: return Response({ 'error': 'Specified price does not exist for plan' }, status=status.HTTP_404_NOT_FOUND) + PRICE_ID = PRICE.stripe_price_id prorated = PRICE.prorated # Return an error if a user is in a user_group and is availing pro-rated plans