mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-04-12 13:01:24 +08:00
Fixed stripe checkouts
This commit is contained in:
parent
99dfcef67b
commit
8d40a33882
1 changed files with 2 additions and 6 deletions
|
@ -67,22 +67,18 @@ class StripeCheckoutView(APIView):
|
||||||
}, status=status.HTTP_404_NOT_FOUND)
|
}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
# Get the stripe_price_id from the related StripePrice instances
|
# Get the stripe_price_id from the related StripePrice instances
|
||||||
PRICE = None
|
|
||||||
PRICE_ID = None
|
|
||||||
|
|
||||||
if annual:
|
if annual:
|
||||||
PRICE = SUBSCRIPTION.annual_price
|
PRICE = SUBSCRIPTION.annual_price
|
||||||
PRICE_ID = PRICE.stripe_price_id
|
|
||||||
else:
|
else:
|
||||||
PRICE = SUBSCRIPTION.monthly_price
|
PRICE = SUBSCRIPTION.monthly_price
|
||||||
PRICE_ID = PRICE.stripe_price_id
|
|
||||||
|
|
||||||
# Return 404 if no price is set
|
# Return 404 if no price is set
|
||||||
if not PRICE or PRICE_ID:
|
if not PRICE:
|
||||||
return Response({
|
return Response({
|
||||||
'error': 'Specified price does not exist for plan'
|
'error': 'Specified price does not exist for plan'
|
||||||
}, status=status.HTTP_404_NOT_FOUND)
|
}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
PRICE_ID = PRICE.stripe_price_id
|
||||||
prorated = PRICE.prorated
|
prorated = PRICE.prorated
|
||||||
|
|
||||||
# Return an error if a user is in a user_group and is availing pro-rated plans
|
# Return an error if a user is in a user_group and is availing pro-rated plans
|
||||||
|
|
Loading…
Add table
Reference in a new issue