auto recurring testing phase 22

This commit is contained in:
rizwanisready
2024-08-02 16:20:04 +05:30
parent 442ce193d4
commit 74425add85

View File

@@ -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