#harefix.dev-webhook-events

1 messages ยท Page 1 of 1 (latest)

agile pine
#

Hello!

shadow oar
#

hello

agile pine
shadow oar
#

oh

#

I find it now

#

can I ask one more question ๐Ÿ™‡

agile pine
#

Sure!

shadow oar
#

right now I can see that webhook has already been fired

#

but I keep getting Stripe::SignatureVerificationError

#

I don't know if the header HTTP_STRIPE_SIGNATURE is missing or not

#

but this webhook I fired by Stripe dashboard

agile pine
#

The signature will always be included in the payload headers

shadow oar
#

yeah

agile pine
#

It's up to you whether you verify the validity of the payload using the signing secret

shadow oar
#

yeah

#

I used it to create the webhook object

#
endpoint_secret = "the sample secret from Stripe Webhook pagee"
payload = request.body.read
sig_header = request.env["HTTP_STRIPE_SIGNATURE"]

@event = Stripe::Webhook.construct_event(
  payload, sig_header, endpoint_secret
)
#

I kinda used the code suggested from Stripe page

#

so it's exactly like this. But it fails in the construct_event part

agile pine
#

Hmm, my guess is that you're webhook endpoint is manipulating the payload somehow

shadow oar
#

I think it's request.body.read

#

after that I used event object to determine the logic in some cases, but basically, all the code in the beginning is the same ๐Ÿ˜ฆ

agile pine
#

Can you try request.data? Or is that something specific to Flask?

shadow oar
#

I'm using Ruby on Rails

agile pine
#

๐Ÿคฆ my bad

shadow oar
#

no, I should have told you ๐Ÿ™‡

agile pine
#

Where is your endpoint_secret from?

shadow oar
#

it came from the stripe cli when I set up, so I just used it to test ๐Ÿ™‡

agile pine
#

And you're forwarding events with the CLI, not a webhook configured in your Dashboard?

shadow oar
#

no, I set up the webhook on dashboard already

#

then I created a payment by the API

#

payment intent, to be specific

#

then I see the payment intent on dashboard is already changed the status to succeeded

#

but in my end, the webhook endpoint throw the error above ๐Ÿ™‡

agile pine
#

Yep, I got that. But you also mentioned the CLI. Are you forwarding events via the CLI? How are you listening for them locally from your Dashboard webhook?