All threads / Stripe - Question about canceling accounts

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Stripe - Question about canceling accounts

Adrian DeGus asked in Rails

I just finished following the screencasts on setting up Stripe, everything went well!

I have my app setup to cancel accounts :at_period_end so that subscribers can continue accessing content through the duration of their subscription.

Question is, how to postpone the removal of their subscription_id from the users table also :at_period_end?

I found it easiest to just listen for the webhook and remove the subscription then. This makes it simpler so your code doesn't have to add in an exception for the case of a user who canceled but is in their grace period and so on. That said, it's not really significantly different to just cancel at period end and also record that data to the user's subscription. You should have both the period end timestamp to record and the subscription could be marked as canceled too. The only adjustment is to make sure that subscriptions in the grace period are still considered active.

Thanks Chris, webhooks were indeed the answer.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,629+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.