Stripe Checkout as a 1-File Rails App
This is a Rails version of Stripe Checkout's suggested Ruby backend, using a single file.
To use it, simply fork, modify what you need to, and deploy.
$ STRIPE_API_KEY=sk_test_asdasda SECRET_KEY_BASE=test puma
How Does It Work?
- When you run
puma, it looks for a file called
config.ruif you don't tell it what to run.
config.ruin this project defines a Rack application, that is,
StripeCheckout. At the end of the file, we
run StripeCheckout, because
run <rack-applicationis how Rack defines what the application is.
- Other than that, we basically just took all the different files generated from
rails newand put them into a single file, then took out everything you don't absolutely need to run this app.
How Can I Expand It?
Basically, look at
rails new output and then add in what you need to. Generally you can add new files in here one at a time.