Loading...
Loading...
Learn how to test and debug Stripe payment webhooks using Webhook.it. This guide covers common webhook events, payload structures, and best practices for integration testing.
Stripe uses webhooks to notify your application about events that happen in your account. Instead of polling the Stripe API for changes, webhooks push data to your server in real-time when events occur. This is essential for handling asynchronous payment flows, subscription lifecycle events, and dispute notifications.
Common scenarios that require webhook handling include: completing orders after successful payments, provisioning access for new subscriptions, sending receipts for invoices, handling failed payment retries, and managing dispute evidence submission deadlines.
Stripe sends over 200 different event types. Here are the most commonly used webhooks that you should test during development:
payment_intent.succeeded - Payment completed successfullypayment_intent.payment_failed - Payment attempt failedcharge.succeeded - Charge was successfulcharge.refunded - Charge was refundedcheckout.session.completed - Customer completed checkoutcheckout.session.expired - Checkout session expiredcheckout.session.async_payment_succeeded - Delayed payment succeededcustomer.subscription.created - New subscription startedcustomer.subscription.updated - Subscription plan changedcustomer.subscription.deleted - Subscription cancelledinvoice.paid - Subscription invoice was paidinvoice.payment_failed - Subscription payment failedGo to Webhook.it homepage and copy your unique webhook URL. This URL will receive all webhook events from Stripe during your testing session.
Log in to your Stripe Dashboard and navigate to Developers > Webhooks. Click "Add endpoint" and paste your Webhook.it URL. Select the events you want to receive or choose "Select all events" for comprehensive testing.
Make sure you're in Test Mode (toggle in the top-right corner) when setting up webhooks for development. Test mode webhooks won't affect real customer data.
Stripe provides a "Send test webhook" button for each endpoint. Click it and select an event type to send a sample payload. You can also trigger real test events by using Stripe's test card numbers in your checkout flow.
Return to Webhook.it to see the incoming webhook. Examine the JSON payload structure, note the event type in the type field, and review the data.object for the actual resource data.
All Stripe webhook events follow a consistent structure. Understanding this format helps you write reliable webhook handlers:
id - Unique identifier for this event (useful for idempotency)type - Event type string like "payment_intent.succeeded"created - Unix timestamp when the event occurreddata.object - The actual Stripe object (PaymentIntent, Subscription, etc.)livemode - Boolean indicating test or live modeWhen inspecting Stripe webhooks in Webhook.it, pay attention to these headers:
application/json for Stripe webhooks.Use Webhook.it to get a free public URL instantly. Configure this URL in your Stripe Dashboard under Developers > Webhooks. Trigger test events using Stripe's 'Send test webhook' button or by making test payments with Stripe's test card numbers.
The webhook secret (whsec_...) is a unique signing key provided by Stripe for each webhook endpoint. It's used to verify that incoming webhooks are genuinely from Stripe by validating the Stripe-Signature header. Always verify signatures in production.
The most important events are: checkout.session.completed (for one-time payments), invoice.paid and invoice.payment_failed (for subscriptions), customer.subscription.created/updated/deleted (for subscription lifecycle), and payment_intent.succeeded (for direct payments).
Common issues: 1) Check if you're in Test Mode vs Live Mode in Stripe Dashboard, 2) Verify the endpoint URL is correct, 3) Check if the events you want are selected, 4) Look at the webhook logs in Stripe Dashboard for delivery attempts and errors.
When invoice.payment_failed fires, you should: 1) Notify the customer about the failed payment, 2) Optionally pause service access, 3) Log the failure for your records. Stripe will automatically retry failed payments based on your Smart Retries settings.