Skip to content

Commit

Permalink
Don't downgrade if active subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Aug 3, 2024
1 parent 89be2b2 commit 3bdbf23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/initializers/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
stripe_customer_id = subscription.customer
if stripe_customer_id.present?
user = User.where(stripe_id: stripe_customer_id).first
if user.present?
if user.present? && !user.has_active_stripe_subscription?
if subscription.cancellation_details&.reason == "payment_failed"
user.update(plan: "Free")
UserMailer.downgraded(user).deliver_now
Expand Down

0 comments on commit 3bdbf23

Please sign in to comment.