From the course: Adding Stripe Payments to Your Ruby on Rails Application

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Cancelling a subscription

Cancelling a subscription

- [Instructor] The next feature we need to add is the ability for you to cancel your subscription. We already have this Cancel my account section down here that comes from Devise. And that allows you to delete your account, which is fine, except we don't want you to be able to delete your user account without first canceling your subscription. So we're going to open up our devise registrations edit.html.erb again, and this time we're going to grab the end down here and move it around the Cancel my account, and we'll insert an else instead. So when we refresh this page we will see that the Cancel my account does not show up if you are currently subscribed. So you'll have to cancel first before you can do that. And we can add a link up here, where it says You are currently subscribed, we'll add a link to Cancel your subscription. And this will point to the subscription path, but it will have a method of delete on it. And this delete will actually submit a delete request to the server…

Contents