Development Setup Fresh
Get familiar with the Stripe CLI and server-side SDKs. Stripe's server-side SDKs and command-line interface (CLI) allow you to interact with Stripe's REST APIs.
Install the Stripe CLI
The Stripe CLI streamlines your development environment and lets you make API calls, listen for webhooks, and trigger test events.
macOS (Homebrew)
bash
brew install stripe/stripe-cli/stripeDebian / Ubuntu
bash
# Add Stripe's GPG key
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg > /dev/null
# Add the apt repository
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list
# Install
sudo apt update
sudo apt install stripeRPM-based Linux
bash
echo -e "[Stripe]\nname=stripe\nbaseurl=https://packages.stripe.dev/stripe-cli-rpm-local/\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/stripe.repo
sudo yum install stripeWindows (Scoop)
bash
scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git
scoop install stripeAuthenticate the CLI
bash
stripe loginThis opens a browser window. Log in with your Stripe account to connect the CLI.
Verify installation
bash
stripe --versionInstall a server-side SDK
Node.js
bash
npm install stripejavascript
const stripe = require('stripe')('sk_test_YOUR_SECRET_KEY');Python
bash
pip install stripepython
import stripe
stripe.api_key = 'sk_test_YOUR_SECRET_KEY'Ruby
bash
gem install stripe
# or add to Gemfile:
# gem 'stripe'ruby
require 'stripe'
Stripe.api_key = 'sk_test_YOUR_SECRET_KEY'PHP
bash
composer require stripe/stripe-phpphp
$stripe = new \Stripe\StripeClient('sk_test_YOUR_SECRET_KEY');Go
bash
go get github.com/stripe/stripe-go/v82go
import (
"github.com/stripe/stripe-go/v82"
)
stripe.Key = "sk_test_YOUR_SECRET_KEY"Java
Add to build.gradle:
groovy
implementation 'com.stripe:stripe-java:27.1.0'java
Stripe.apiKey = "sk_test_YOUR_SECRET_KEY";Make your first API call
Create a customer to verify your setup:
bash
stripe customers create \
--email="test@example.com" \
--name="Test User"Or via curl:
bash
curl https://api.stripe.com/v1/customers \
-u sk_test_YOUR_KEY: \
-d email="test@example.com" \
-d name="Test User"Listen for webhooks locally
During development, forward webhook events to your local server:
bash
stripe listen --forward-to localhost:3000/webhooksThis gives you a webhook signing secret to use in local testing. The CLI prints events to the terminal as they fire.
Trigger test events
Simulate specific events without a browser:
bash
stripe trigger payment_intent.succeeded
stripe trigger customer.subscription.created
stripe trigger invoice.payment_failed