stripe-sinatra-example

Created: 2011-07-12 06:25
Updated: 2018-03-28 16:09

README.md

Stripe Sinatra Example

A very simple but working example with the Stripe APIs. This app lets you charge any credit card any amount you want and have the funds deposited in your Stripe account. Not bad for less than 100 lines of code.

What you'll need

Configuration

  • Fork or download.

  • Get your API keys from the API Keys page on stripe.com.

  • Change the API key on line 5 of in app.rb:

      Stripe.api_key = "STRIPE_API_PRIVATE_KEY"
    
  • Change the API key on line 7 of views/form.erb:

      Stripe.setPublishableKey('PUBLISHABLE_KEY');
    
  • Run your app with ruby app.rb (or shotgun app.rb if using shotgun), click Submit Payment, and you should see your charge registered on the stripe dashboard.

By default this form will bill the stripe test credit card 4242424242424242. You can do all kind of cool stuff with these APIs. Check out the official docs.

To-do

  • Check for the response code and report that to the user
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more