Local Webhook Testing
To perform local webhook testing using the Stripe CLI
, please do the following:
-
Set
-H
tox-djstripe-webhook-secret
Custom Header in Stripelisten
to theWebhook Signing Secret
output ofStripe CLI
. That is what Stripe expects and uses to create thestripe-signature
header. Without thatwebhook
validation will fail and you would get a400
status code. -
Set
--forward-to
to theURL
you want stripe to forward the request to. New StyleUUID
urls are also supported fromv2.7
onwards. -
Start the local
Stripe
server like so:
stripe listen -H "x-djstripe-webhook-secret: <STRIPE_CLI_WEBHOOK_SIGNING_SECRET_OUTPUT>" --forward-to <URL>
Stripe
events can now be triggered like so:
stripe trigger customer.created
Note
In case the Stripe CLI
is used to perform local webhook testing, set -H
to x-djstripe-webhook-secret
Custom Header in Stripe listen
to the Webhook Signing Secret
output of Stripe CLI
. That is what Stripe expects and uses to create the stripe-signature
header.