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

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 Render account
  2. Run it on Heroku
  3. Run it locally on your machine
  4. 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 Render

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

Deploy to Render

Running on Heroku

  1. Set up a 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.