Skip to content

starback/stripe-sinatra-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple example of the Stripe APIs used in a Sinatra app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%