๐Ÿ’ณStripe Payment Gateway

Stripe setup

circle-info

The boilerplate comes by default with Single payments stripe checkout. We are working on adding subscriptions, in the meantime, you can modify the existing checkout controller with a few lines to activate subscriptions.

We use stripe checkout and pay gem for easy paywall setup and webhooks. To start using Stripe follow this guide:

Create account

Go to Stripearrow-up-right arrow-up-rightand create an account.

Install stripe CLI in your terminal

For us to listen to stripe webhooks and test in development, we need to install stripe CLI in our terminal:

For macOS:

brew install stripe/stripe-cli/stripe

Or for Ubuntu, check the official documentation.arrow-up-right

Then login:

stripe login -i

This should ask you for an API key, you will find it in Test > Developers > API Keys arrow-up-right> Secret Key

API keys and webhook secrets

Start listening to your webhook events by running in your terminal:

This webhook comes by default with the pay gem. If you wish to create custom webhooks refer to the Pay Gemarrow-up-right documentation.

Add the API Keys in the Rails credentials file. Open the file from the terminal with the following line:

Add the keys in the file with this exact wording for the keys and save:

Credentials Edit file

Pay gem

All the Pay Gemarrow-up-right setup is taken care of by LightningRails, the only setup needed from your side to get the gem to work is:

  • Go to application.rb and replace the example domain with your domain so Pay can generate links (for features like Stripe Checkout).

  • Create a product on the stripe product catalog, copy the product ID, and paste it on the checkouts_controller.rb action Show:

Set your pricing

Now that you have created your product on Stripe, ensure all the UI has the correct pricing, and modify the price on the _price_cards.rb component.

Premium Authorisation

Hide your premium features behind the paywall by adding the following line in the premium controllers/actions

Last updated