Add payments using Stripe or Braintree to your application
Icons/chart bar
Used 58 times
Created by
J Jason Charnes

Once you've run the Pay template, don't forget to add your credentials! 🔒

For more information on Pay, check out the readme.

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION=""
Template Source

Review the code before running this template on your machine.

run "spring stop"

processor = ask "Are you using Stripe or Braintree? [s/b]"

if processor.downcase == "stripe" || processor == "s"
  gem "pay", "~> 2.0"
  gem "stripe", "< 6.0", ">= 2.8"
  gem "stripe_event", "~> 2.3"
elsif processor.downcase == "braintree" || processor == "b"
  gem "braintree", "< 3.0", ">= 2.92.0"
  gem "pay", "~> 2.0"
  puts "Um, we don't know what #{processor} is 😅"

run "bundle install"

model = ask "What is the name of your 'billable' model? (Default: User)"
model = "User" if model.blank?

generate(:pay, model)
run("rake db:migrate")

puts "❗ Don't forget to add your #{processor} credentials to your application!"
puts "💰 Go forth and make money!"

Sign up or Login to leave a comment.