Skip to content

Commit

Permalink
update webhooks for subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Mar 16, 2021
1 parent 80a055f commit de5e265
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions app/controllers/webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ def create
customer = event.data.object
@user = User.find_by(email: customer.email)
@user.update(stripe_customer_id: customer.id)
when 'checkout.session.completed'
session = event.data.object
@user = User.find_by(stripe_customer_id: session.customer)
@user.update(subscription_status: 'active')
when 'customer.subscription.updated', 'customer.subscription.deleted'
when 'customer.subscription.updated', 'customer.subscription.deleted', 'customer.subscription.created'
subscription = event.data.object
@user = User.find_by(stripe_customer_id: subscription.customer)
@user.update(
Expand Down

0 comments on commit de5e265

Please sign in to comment.