Sign in
An image of the Stripe logo
Create account
Sign in
Home
Payments
Business operations
Financial services
Developer tools
No-code
All products
Home
Payments
Business operations
Home
Payments
Business operations
Financial services
Developer tools
Support
Overview
Developer tools
    Get started
    Quickstarts
    Stripe Shell
    Stripe CLI
    Dashboard
    Stripe for Visual Studio Code
    Webhooks
    File uploads
    Error handling
    Security at Stripe
    API
    API keys
    Upgrades
    Changelog
    Rate limits
    Data Availability
    Expanding responses
    Domains and IP addresses
    Search
    Building With Stripe
    Prebuilt iOS UI
    Prebuilt Android UI
    Extensions
    Samples
    Checklist
    Feedback
SDKs
Sample projects
Videos
Stripe Apps
Stripe Connectors
Partners
HomeDeveloper tools

Development environment quickstarts

Fast-track local development with the essential tools needed for a Stripe integration.

Quickstarts by language

Stripe’s server-side helper libraries (also known as server-side SDKs) and Command Line Interface (CLI) allow you to interact with Stripe’s REST APIs. Start with the Stripe CLI and make Stripe API calls without writing a line of code. Use the SDKs to avoid writing boilerplate code. To start sending requests from your environment, choose a language to follow a quickstart guide.

In this quickstart, you install the Stripe CLI—an essential tool that gets you command line access to your Stripe integration. You also install the Stripe Ruby server-side SDK to get access to Stripe APIs from applications written in Ruby.

What you learn

In this quickstart, you’ll learn:

  • How to call Stripe APIs without writing a line of code
  • How to manage third-party dependencies using a bundler with RubyGems
  • How to install the Stripe Ruby SDK v8.0.0
  • How to send your first SDK request

Initial setup

Click the Sign in button to login to the Stripe docs site, and start using your test mode API keys for authenticated requests.

Setup the Stripe CLI

  1. From the command-line, use an install script or download and extract a versioned archive file for your operating system to install the CLI.

To install the Stripe CLI with homebrew, run:

Command Line
brew install stripe/stripe-cli/stripe
  1. Login and authenticate your Stripe user Account to generate a set of restricted keys. To learn more, see Stripe CLI keys and permissions.
Command Line
stripe login
  1. Press the Enter key on your keyboard to complete the authentication process in your browser.
Output
Your pairing code is: enjoy-enough-outwit-win This pairing code verifies your authentication with Stripe. Press Enter to open the browser or visit https://dashboard.stripe.com/stripecli/confirm_auth?t=THQdJfL3x12udFkNorJL8OF1iFlN8Az1 (^C to quit)
  1. Now that you’ve installed the CLI, you can make a single API request to Create a product.
Command Line
stripe products create \ --name="My First Product" \ --description="Created with the Stripe CLI"
  1. Look for the product identifier (in id) in the response object. Save it for the next step.

If everything worked, the command-line displays the following response.

{ "id":
"prod_LTenIrmp8Q67sa"
, "object": "product",
  1. Next, call Create a price to attach a price of 30 USD. Swap the placeholder in product with your product identifier (for example, prod_LTenIrmp8Q67sa).
Command Line
stripe prices create \ --unit-amount=3000 \ --currency=usd \ --product=
{{PRODUCT_ID}}

If everything worked, the command-line displays the following response.

{ "id":
"price_1KzlAMJJDeE9fu01WMJJr79o"
, "object": "price",

Manage third-party dependencies

We recommend managing third-party dependencies using the RubyGems command-line tool, which allows you to add new libraries and include them in your Ruby projects. Check whether RubyGems is installed:

Install RubyGems

Command Line
gem --version

If you get gem: command not found, download RubyGems from their downloads page.

Install the Ruby Server-side SDK

The latest version of the Stripe Ruby server-side SDK is v8.0.0. It supports Ruby versions 2.3+.

  1. Check your Ruby version:
Command Line
ruby -v

Install the library

We recommend creating a gem file then installing the generated gem using a bundler with RubyGems.

  1. To add the latest version of the Stripe gem to a project, run the following command:
Command Line
bundle add stripe
  1. Alternatively, you can add the latest version of the library as a gem dependency:
Gemfile
source 'https://rubygems.org' gem 'rails' gem 'stripe'
  1. Next, install the required gems from your specified sources:
Command Line
bundle install

Global installation

  1. Alternatively, you can install the library globally with RubyGems:
Command Line
gem install stripe

Manual installation

  1. Additionally, you can build the gem from source, and then install the library by running:
Command Line
gem build stripe.gemspec

Run your first SDK request

Now that you have the Ruby SDK installed, you can create a subscription Product and attach a Price with a couple API requests. We’re using the product identifier returned in the response to create the price in this example.

This sample uses your Stripe user account’s default keys for test mode. Only you can see these values.

create_price.rb
require 'rubygems' require 'stripe' Stripe.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" starter_subscription = Stripe::Product.create( name: 'Starter Subscription', description: '$12/Month subscription', ) starter_subscription_price = Stripe::Price.create( currency: 'usd', unit_amount: 1200, recurring: {interval: 'month'}, product: starter_subscription['id'], ) puts "Success! Here is your starter subscription product id: #{starter_subscription.id}" puts "Success! Here is your starter subscription price id: #{starter_subscription_price.id}"
  1. Save the file as create_price.rb. From the command line, cd to the directory containing the file you just saved then run:
Command Line
ruby create_price.rb

If everything worked, the command line shows the following response. Save these identifiers so you can use them while building your integration.

Command Line
Success! Here is your starter subscription product id: price_0KxBDl589O8KAxCG1alJgiA6 Success! Here is your starter subscription price id: price_0KxBDm589O8KAxCGMgG7scjb

See also

This wraps up the quickstart. See the links below for a few different ways to process a payment for the product you just created.

  • Create a payment link
  • Prebuilt Checkout page
  • Custom payment flow
Was this page helpful?
Questions? Contact us.
Watch our developer tutorials.
Check out our product changelog.
Powered by Markdoc
You can unsubscribe at any time. Read our privacy policy.
On this page
Quickstarts by language
What you learn
Initial setup
Setup the Stripe CLI
Manage third-party dependencies
Install the Ruby Server-side SDK
Run your first SDK request
See also
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Login to your Stripe account and press Control + Backtick on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g. )
The Stripe Shell is best experienced on desktop.
$