#Getting Started

Once you've installed the kiso_stripe_payments gem, you will have access to some new Rails generator commands, which you can see by running:
$ bin/rails g | grep kiso

Choose which generator you want to run: do you need Stripe transactions (one-off payments) in your app, or do you need Stripe subscriptions (recurring monthly charges)?
For transactions, run the kiso_stripe_payments:install_transactions generator. For subscriptions, run the kiso_stripe_payments:install_subscriptions generator.
When running either generator, you will need to specify the owning model for the transactions or subscriptions. For example, if the Stripe transactions should be owned by the User model:
 bin/rails g kiso_stripe_payments:install_transactions User

#Transactions Generator

The transactions generator is the simpler of the two, since handling transactions is fairly simple. When the generator runs, it will inject code (acts_as_stripe_transactor) into the User model that connects it to the Stripe transactions model, as well as create the necessary migrations

#Subscriptions Generator

There are several parts this generator executes. Like the Transactions generator, you must specify an owning model for the subscriptions:
 bin/rails g kiso_stripe_payments:install_subscriptions User
An initializer kiso_stripe_payments_subscriptions.rb will be copied to your config/initializers folder, and the KisoStripePayments engine will be mounted in your routes.rb file under the path /kiso_stripe_payments.
Tables and models will be created for the following:
  • Products (for managing groups of Stripe Plans)
  • Plans
  • Plan changes
  • Customers
  • Subscriptions
  • Basic metrics

#Webhooks Generator

If you want to handle incoming Stripe webhooks, and you should, running this generator will create a model and table for handling the Stripe webhook, as well as injecting a route into your route table for receiving the webhooks at kiso_stripe_payments/webhooks using the StripeEvents gem.

#View Generator

Running this generator will eject the views from the KISO Stripe Payments gem into your project for further customization. This allows you to edit any of the partials, say the credit card collection form for example, to however you see fit.