Use the Stripe CLI
Build, test, and manage your Stripe integration from the command line.
The Stripe CLI lets you build, test, and manage your Stripe integration from the command line. With the CLI, you can create and manage Stripe resources, trigger webhook events, stream real-time API request logs, and forward events to your local development environment.
Specify an API version while running requests
When you call Stripe APIs in the CLI, it uses your default API version in all requests, which you can identify in Workbench. To try out different API versions in the CLI, use the following flags:
Flag | Description | Example |
---|---|---|
| Use the --stripe-version flag in any CLI request to specify an API version. | stripe products create --name=“My Product” --stripe-version 2025-08-27. |
--latest | Use the --latest flag in any CLI request to specify the latest API version. | stripe products create --name="My Product" --latest |
You can also view a list of API versions.
Stream request logs
Use the stripe logs tail
command to stream API request logs. Keep this window open. If you have an error in your API calls, this terminal returns the API error message and a reason for the error.
stripe logs tail
Forward events to your local webhook endpoint
Use the --forward-to
flag to send all Stripe events in a sandbox to your local webhook endpoint. To disable HTTPS certificate verification, use the --skip-verify
flag.
stripe listen --forward-to localhost:4242/webhooks
Ready! Your webhook signing secret is '{{WEBHOOK_SIGNING_SECRET}}' (^C to quit)
To forward specific events in a comma separated list, use the --events
flag.
stripe listen --events payment_intent.created,customer.created,payment_intent.succeeded,charge.succeeded,checkout.session.completed,charge.failed \ --forward-to localhost:4242/webhook
If you’ve already registered your endpoint in Stripe, you can use the --load-from-webhooks-api
and --forward-to
flags.
stripe listen --load-from-webhooks-api --forward-to localhost:4242
This command forwards events sent to your Stripe-registered public webhook endpoint to your local webhook endpoint. It loads your registered endpoint, parses the path and its registered events, then appends the path to your local webhook endpoint in the --forward-to
path. If you’re checking webhook signatures, use the {{WEBHOOK_
from the initial output of the listen
command.
List all available events
Use the help flag (--help
) to list all possible events that can occur for an event category. For example, to list all possible events for the prebuilt checkout page for Stripe Checkout:
stripe trigger checkout --help
Create a one-time product and price
Make a single API request to Create a product.
Command Linestripe 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":
, "object": "product","prod_LTenIrmp8Q67sa"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 Linestripe prices create \ --unit-amount=3000 \ --currency=usd \ --product=
{{PRODUCT_ID}}If everything worked, the command-line displays the following response:
{ "id":
, "object": "price","price_1KzlAMJJDeE9fu01WMJJr79o"
Trigger a webhook event while testing
Trigger the checkout.
event to create the API objects that result from a checkout session successfully completing.
stripe trigger checkout.session.completed
Your stripe listen
terminal displays the following output:
Setting up fixture for: checkout_session Running fixture for: checkout_session Setting up fixture for: payment_page Running fixture for: payment_page Setting up fixture for: payment_method Running fixture for: payment_method Setting up fixture for: payment_page_confirm Running fixture for: payment_page_confirm Trigger succeeded!