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
Overview
Developer tools
    Get started
    Quickstarts
    Stripe Shell
    Stripe CLI
    Dashboard
    Stripe for Visual Studio Code
    Webhooks
      Events overview
      Listen for events
      Webhook builder
      Test webhooks
      Check signatures
      Best practices
      Go live
    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 toolsWebhooks

Test a webhooks integration with the Stripe CLI

Test that your webhook endpoint is working properly before taking it live.

Simulate Stripe events to test a webhooks integration using the stripe trigger <event> command. When you trigger an event, Stripe issues HTTP requests against Stripe APIs, creating all API objects that correspond to that event.

Before you begin

  • Install the Stripe CLI and log in to authenticate your account.
  • Use the Interactive webhook endpoint builder to build a webhook endpoint.

Forward events to a local webhook endpoint

  • Use the --forward-to flag to send all Stripe events in test mode to your local webhook endpoint. To disable HTTPS certificate verification, use the --skip-verify flag.
Command Line
stripe listen --forward-to localhost:4242/stripe_webhooks
Output
Ready! Your webhook signing secret is '{{WEBHOOK_SIGNING_SECRET}}' (^C to quit)
  • Optionally, use the --events flag to forward specific events in a comma separated list.
Command Line
stripe listen --events payment_intent.created,customer.created,payment_intent.succeeded,charge.succeeded,checkout.session.completed,charge.failed \ --forward-to localhost:4242/webhook
  • Optionally, if you’ve already registered your endpoint in Stripe, use the --load-from-webhooks-api and --forward-to flags.
Command Line
stripe listen --load-from-webhooks-api --forward-to localhost:5000

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.

Trigger events to test your webhooks integration

  • Run the stripe trigger checkout.session.completed command to simulate the event that occurs when a customer payment is successful for the Create a session API in the Prebuilt Checkout page.
Command Line
stripe trigger checkout.session.completed
  • Run the stripe trigger payment_intent.succeeded command to simulate the event that occurs when a customer payment is successful for the Create a PaymentIntent API in the Custom payment flow.
Command Line
stripe trigger payment_intent.succeeded

Next steps

  • Take webhooks live
Was this page helpful?
Questions? Contact Sales.
Need help? Contact Support.
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
Before you begin
Forward events to a local webhook endpoint
Trigger events to test your webhooks integration
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.
$