Pay
Add payments using Stripe or Braintree to your application
Used 66 times
J
Jason Charnes
Usage
Once you've run the Pay template, don't forget to add your credentials! 🔒
For more information on Pay, check out the readme.
For more information on Pay, check out the readme.
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/zPdsZn"
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"
else
puts "Um, we don't know what #{processor} is 😅"
abort
end
run "bundle install"
model = ask "What is the name of your 'billable' model? (Default: User)"
model = "User" if model.blank?
rails_command("pay:install:migrations")
generate(:pay, model)
run("rake db:migrate")
puts "❗ Don't forget to add your #{processor} credentials to your application! https://github.com/pay-rails/pay#payment-providers"
puts "💰 Go forth and make money!"