Integrating Stripe for Memberships

I’m currently involved in the group project (Agile Team Chess Application). Prior to that I had some time while I was waiting for a group, so I created a golf stat tracking application. I’ve been in golf my whole life….ran courses, taught full time, so this was a passion project of mine. Well it’s still ongoing….

When I started out, I had a layout in mind as far as what I wanted to show, but my application evolved. ALL APPLICATIONS EVOLVE! Remember that! Sandy Metz couldn’t be more correct. It evolved to the point that I wanted to add a Premium Section, a place where you had to pay to get access if you wanted to view the content. My mentor pushed me in this direction because when you are looking for employment, startups typically use STRIPE as their perferred payment method and it would be beneficial if you have experience in the installation.

1- Install the Stripe and Figaro Gem

Figaro is important because you will have KEYS for Live Production, that Stripe provides you that you will need to store in ENV Variables for Heroku.

2- Memberships Controller

For PREMIUM, I only require a 1 time fee, $5 and that gives you lifetime access to the content. You can also setup recurring charges. I encourage you to check out the Stripe Subscription Plans if you need something that suits your needs.

When a stripe customer is created and their card is charged, I change their “subscribed” statues to TRUE (line 32 ABOVE) I added this functionality for USERS to my db.schema — (line 79 BELOW). I then re-direct them to a “Thankyou” page so they can print a receipt.

I can then use that logic in my controller and routes to allow acess to content -

Now my view requires a membership. I did this for all pages that require a premium membership. Hope you enjoyed. Have fun integrating Stripe into your applications!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.