Stripe plugin webhooks error - No signatures found matching the expected signature for payload

default discord avatar
philiposaurus
7 months ago
3

I am getting this error when locally testing a Stripe webhook:


ERROR (payload): No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing


I basically only use payment intents in Stripe and would like to sync succesful payments into payload.


I am using this webhook:

payment_intent.succeeded

.



When running the stripe forward command


stripe listen --forward-to localhost:8000/stripe/webhooks


And then triggering the webhook:


stripe trigger payment_intent.succeeded

The above error gets logged. Never is my function called in the plugin config. Does someone know what is up here?



Ahhh after banging my head into the keyboard for 3 hours I find the solution 5 mins after posting. It was logging some webhook secret upon starting the connection which needed to be added into the .env file.



How do I find this secret for production though?

  • discord user avatar
    jacobsfletch
    Payload Team
    7 months ago

    @philiposaurus heyyy glad you figured it out. You're exactly right, in dev that secret just gets logged to the console and you need to paste it into your

    .env

    . That webhook server is only ever run in development, though. In production you create webhooks via the admin panel and Stripe provides the signing secret at that time.

  • default discord avatar
    philiposaurus
    7 months ago

    Right, thanks for clarifying! That makes sense.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.