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,400 courses taught by industry experts.

Displaying charges in the account page

Displaying charges in the account page

- [Instructor] Now that we have our charges being synced back to our Rails application, we can print out a table at the bottom for any of the receipts that you have so far. As a reminder, in development, your server is not accessible to the public internet, so you'll have to use the Rails console to sync Webhook charge events to your local database so that you can test out your application with those. So if we go to our Rails application and open up our registrations edit.html.erb file. We can go down to the bottom and say, if current_user.charges.any then we'll print out a charges section. And this will be a simple table. We'll have have a header and each of these will be a date and an amount so we'll print out the charge amount and we'll have a link to download that receipt. So we'll also print out a body and for each of the lines of the body, we're going to say current_user.charges.each do charge and we'll print out a TR for each of those. So that there's a row for every single…

Contents