Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

4466 articles

Set up your development environment


Set up your development environment

Get familiar with the Stripe CLI and our server-side SDKs.

Stripe’s server-side SDKs and command-line interface (CLI) allow you to interact with Stripe’s REST APIs. Start with the Stripe CLI to streamline your development environment and make API calls.

Use the SDKs to avoid writing boilerplate code. To start sending requests from your environment, choose a language to follow a quickstart guide.

Chrome extensions

We recommend you build your payment integration with Stripe (such as Elements or Checkout) on your own website. Then, set up your Chrome extension to send users to this payment page when they’re ready to complete a purchase.

This method is more secure and easier to maintain than trying to handle payments directly within the extension.

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 v 19.6.0
  • How to send your first SDK request

Set up the Stripe CLI

Install and connect

Install the Stripe CLI with npm:

Command Line

npm install -g @stripe/cli@latest

After installation, log in to your Stripe account:

Command Line

stripe login

After you install the CLI, you can also install agent tooling, or set up autocompletion.

Note

For more installation options for Windows, macOS, Linux, and Docker, see the Stripe CLI readme on GitHub.

Confirm setup

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"

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",

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 v 19.6.0. It supports Ruby versions 2.3+.

Check your Ruby version:

Command Line

ruby -v

Install the library

Create a gem file and install the generated gem using a bundler with RubyGems.

Add the latest version of the Stripe gem to a project:

Command Line

bundle add stripe

Install the required gems from your specified sources:

Command Line

bundle install

Installation alternatives

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.

Use best practices for API keys

This sample uses the default keys of your Stripe user account for your sandbox environment. Only you can see these values. Follow best practices to manage your keys safely.

create_price.rb

require 'rubygems'
require 'stripe'

# Don't embed any keys in production code. This is an example.
# See https://docs.stripe.com/keys-best-practices.
client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2")

starter_subscription = client.v1.products.create(
 name: 'Starter Subscription',
 description: '$12/Month subscription',
)

starter_subscription_price = client.v1.prices.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}"

Save the file as create_price.rb. From the command line, cd to the directory containing the file you just saved and 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: prod_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.

Last verified 2026-09-24

Is this helpful?