Sell a file with your Stripe account and Ruby on Rails.
What is it?
Thylacine is a Rails 3.1 app that lets you sell a digital using your Stripe (www.stripe.com) account. It's designed for people who want to sell things like ebooks or code but not mess around with setting up a store or pay high transaction fees.
What Can I Sell?
Um, anything you want–so long as it's 1 file. For example, you could sell:
A PDF ebook
An ebook in multiple formats, inside a .zip file
An instructional video
A collection of stock photography, inside a .zip file
Code you want to sell, inside a .zip file
Remember, 1 file. Thylacine is not a shopping cart. It doesn't calculate sales tax, shipping, or require registration. A person goes to the site, they give you money, they get a file.
View a demo deployed to Heroku at: thylacine.herokuapp.com
What's a Thylacine?
While it sounds like a new prescription anti-depressant, a Thylacine is actually an extinct carnivorous marsupial once native to Australia. The Thylacine was also known as the “Tasmanian tiger” because it had stripes on its back. Since this app uses Stripe for payment processing, I figured I'd name it after some sort of striped animal. Zebra and Tiger seemed boring.
Setup and Configuration
Clone the app
Bundle install to get your gems in order
Create and migrate your database
Edit config/initializers/stripe.rb and add your Stripe api key and publishable key
Place your file (the one you're selling) in app/products/
Edit config/product.yml and add the details about your product (including the file name from the previous step)
At this point, the app is usable and you can sell your file. However, you'll want to edit the index view with all the great marketing copy about your product. The (HAML) file you want to edit is app/views/product/index.html.haml.
After a successful purchase, the customer is directed to a “Thank you” page. There they are presented with a download button which streams the file when clicked. Both the thanks and download actions require a authentication token in order to work (this is a unique token generated for each order record).
Planned features below. If you have feature requests or bugs, submit an issue or pull request.
Send email receipt to customer
Add file deliver via email option
Monitor (and possibly limit) the number of downloads per customer
Add an admin view into all orders
Add an expiration date for downloads
A Note About SSL
Customer credit card data is sent securely to Stripe and never touches the Thylacine app server or database. Therefore, SSL is technically unnecessary (I think). However, I'm of the opinion that running Thylacine over SSL is still preferred in order to maintain a level of comfort with end-users.
Other free and open source projects were used to build this. Ruby on Rails, Twitter Bootstrap, Startup Ipsum (site), and others all deserve props.