Format a Webhook Payload
Webhooks deliver events as JSON POST bodies that often arrive minified. This example shows a Stripe-style payment webhook with a nested data object wrapping the event. Formatting the payload reveals the full structure before you write handler code. Keep this as a reference fixture for your test suite when building webhook integrations.
Example
{
"id": "evt_1OqXample",
"type": "payment_intent.succeeded",
"created": 1700000000,
"livemode": false,
"data": {
"object": {
"id": "pi_3OqXample",
"amount": 4999,
"currency": "usd",
"status": "succeeded",
"customer": "cus_Xample123",
"metadata": { "order_id": "ord_789" }
}
}
}FAQ
- How do I test webhooks locally?
- Use a tool like ngrok or Stripe CLI to forward webhooks to localhost. The webhook payload formatter helps you understand the structure before writing handler code.
- Should I verify webhook signatures?
- Yes, always. Most webhook providers include a signature header (e.g., Stripe-Signature) that you should verify using the shared secret before trusting the payload.
- What is the difference between an event type and an event object?
- The type field identifies what happened (e.g., payment_intent.succeeded). The data.object contains the full resource that triggered the event.
Related Examples
Format a REST API Response
REST APIs return compact JSON that is hard to read at a glance. Paste this examp...
Format an API Error ResponseStructured error responses help API clients handle failures gracefully, but they...
Inspect a JWT Token PayloadA JWT consists of three Base64url-encoded parts; the payload carries all the cla...