#Monimolimnion - Laravel Webhooks

1 messages ยท Page 1 of 1 (latest)

limber lantern
#

Hi ๐Ÿ‘‹

cold dust
#

This one is almost always because the constructEvent requires the rawBody of the request - the needed information is encoded in the "non-coding" part of the JSON body - extra spaces, line breaks, etc. Any processing will change those.

limber lantern
#

Yup. Even some hosting providers can transform request payloads. There should be examples of Laravel specific webhooks handlers on Stack Overflow but unfortunately I'm not familiar enough with Laravel to know what transformations are required.

acoustic light
#

Hmm

limber lantern
#

Can you share your webhook handler code?

#

At least how it's getting the body

acoustic light
#

I'm using:

#

Which apparently just handles everything automagically

#

And locally, it does just that

#

If I disable the signature checking in the config, everything (saving an order and sending emails via a Laravel Event) works perfectly

#

Oh

#

My bad

#

It's this one, stripe specific

#

Wait... I've just thought

vale warren
#

๐Ÿ‘‹ @limber lantern has to head so I'm hopping in - give me a bit to catch up

acoustic light
#

Does the webhook secret change when you're using test mode? Even if it's a live, online webhook?

cold dust
#

There are entirely separate Test and Live webhooks & secrets

acoustic light
#

well... that bears checking out ๐Ÿคฆ

#

......

#

that was the problem

#

or rather as usual... I was the problem

cold dust
#

It's like 80% of the time not having the rawBody, and most of the rest are the secret being out of sync in some way

acoustic light
#

in my local environment i'd just been using the secret generated by the CLI where I listened for the webhook

#

then I created the one on the dashboard and figured it was the same key because it was the same hook

#

so just to be clear, when I switch to live mode I'm now switching my secret key, public key, and any webhook secrets to their live versions

cold dust
#

yep.

acoustic light
#

well, thank you all for your help

#

that's a load off my mind