Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.26 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.26 KB

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