diff --git a/manage_subscriptions/views.py b/manage_subscriptions/views.py index 163c283..5575340 100644 --- a/manage_subscriptions/views.py +++ b/manage_subscriptions/views.py @@ -119,9 +119,9 @@ class SubscriptionCreateOrUpdateView(LoginRequiredMixin, generic.View): def handle_stripe_price(self, form): try: stripe.api_key = settings.STRIPE_SECRET_KEY - + stripe_product_id = form.instance.stripe_product.product_id if form.instance.stripe_product else None # creating Stripe price only if the subscription is not free - if not form.cleaned_data.get("is_free"): + if not form.cleaned_data.get("is_free") and stripe_product_id: # Getting Stripe Product ID stripe_product = form.instance.stripe_product plan = form.instance.plan