Skip to content

A simple, easy-to-deploy backend that you can use to run the Stripe Terminal example apps

License

Notifications You must be signed in to change notification settings

mshafrir-stripe/example-terminal-backend

 
 

Repository files navigation

Example Terminal Backend

This is a simple Sinatra webapp that you can use to run the Stripe Terminal example apps. To get started, you can choose from the following options:

  1. Run it on a free Heroku account
  2. Run it locally on your machine
  3. Run it locally via Docker CLI

ℹ️ You also need to obtain your Stripe secret, test mode API Key, available in the Dashboard. Note that you must use your secret key, not your publishable key, to set up the backend. For more information on the differences between secret and publishable keys, see API Keys. For more information on test mode, see Test and live modes.

Running the app

Running on Heroku

  1. Set up a free Heroku account.
  2. Click the button below to deploy the example backend. You'll be prompted to enter a name for the Heroku application as well as your Stripe API key.
  3. Go to the next steps in this README for how to use this app

Deploy

Running locally on your machine

If you prefer running the backend locally, ensure you have the required Ruby runtime version installed as per the latest Gemfile in this repo.

You'll also need the correct Bundler version, outlined in the Gemfile.lock under the BUNDLED_WITH directive.

Clone down this repo to your computer, and then follow the steps below:

  1. Create a file named .env within the newly cloned repo directory and add the following line:
STRIPE_TEST_SECRET_KEY={YOUR_API_KEY}
  1. In your terminal, run bundle install
  2. Run ruby web.rb
  3. The example backend should now be running at http://localhost:4567
  4. Go to the next steps in this README for how to use this app

Running locally with Docker

We have a pre-built Docker image you can run locally if you're into the convenience of containers.

Install Docker Desktop if you don't already have it. Then follow the steps below:

  1. In your terminal, run docker run -e STRIPE_TEST_SECRET_KEY={YOUR_API_KEY} -p 4567:4567 stripe/example-terminal-backend (replace {YOUR_API_KEY} with your own test key)
  2. The example backend should now be running at http://localhost:4567
  3. Go to the next steps in this README for how to use this app

Next steps

Next, navigate to one of our example apps. Follow the instructions in the README to set up and run the app. You'll provide the URL of the example backend you just deployed.

SDK Example App
iOS https://github.com/stripe/stripe-terminal-ios
JavaScript https://github.com/stripe/stripe-terminal-js-demo
Android https://github.com/stripe/stripe-terminal-android

⚠️ Note that this backend is intended for example purposes only. Because endpoints are not authenticated, you should not use this backend in production.

About

A simple, easy-to-deploy backend that you can use to run the Stripe Terminal example apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 89.8%
  • HTML 4.2%
  • Shell 3.2%
  • Dockerfile 2.4%
  • Procfile 0.4%