#run-webhook-signature

1 messages ยท Page 1 of 1 (latest)

wispy kayakBOT
runic finch
#

run-webhook-signature

#

@round quail the problem is not that there is "no signature", it's that the one you pass doesn't match the data you pass. That's what the error message is trying to tell you.

  • 90% of the time, the problem is that you pass the wrong "WebhookEndpoint secret" that looks like whsec_123. For example you use the CLI and didn't know there's a separate secret, or you pass a Secret API key or something
  • 10% of the time it's because you aren't giving us the exact raw payload we sent you. Something in your system (almost always when using Node.js) is giving us data that has been modified
round quail
#

I think its the first option, currently on my local i have the webhook secret that the cli gives me, but on my deployment(vercel) i have the one thats on the dashboard

#

Also, i have 2 apps with 2 endpoints for the webhooks, but whenever i trigger a webhook for app B, it shows on the logs for app A, is that normal is that possibly part of the issue?

runic finch
#

If an Event evt_12345 happens on your account it will be sent to every WebhookEndpoint that is on your account. There is no notion of "app B triggered this Event so send this only to WebhookEndpoint 12345"

round quail
#

Got it, so if I am using the cli, i use the whsec that it gives me and if im using my vercel, i would use the whsec thats on the dashboard?

runic finch
#

correct

round quail
#

Alright, ill go over my env variables

#

I have one more question should i ask here or start a new thread?

round quail
runic finch
#

haha I should add "env variables" as another common cause ๐Ÿ˜…

#

and you can just ask your other question here!

round quail
round quail
runic finch
#

The best approach is to use metadata for this

#

You can set metadata on your PaymentIntent for example (depends a lot on how you integrated) and you'd get it in the Event

round quail
#

So when i create the stripe session, i pass the trip info(date,origin, destination, etc) in the metadata, then in the webhook endpoint, i use the info in the metadata to create the trip

runic finch
#

yes!

#

or just pass metadata of some "trip ip" in metadata and load that from your database

round quail
#

trip id?

runic finch
#

you said something about a trip so I assume it's kind of your "order" and you would have some "id" that makes sense to you like in your database

round quail
#

yeah, i was just wondering if thats what you meant with "trip ip"

#

but then after i create the trip, how do i go from the webhook to the client/frontend

#

is it possible to return a response from the webhook POST request and access it?

runic finch
#

ahhhhh lol sorry typo

#

there isn't really a reason to have a "front end" involved in webhooks though

#

If you are talking about the redirect after Checkout Session completes then the webhook is not relevant

round quail
#

but my trip gets created in the webhook

runic finch
#

but why?

round quail
#

I only want the trip to be created once the payment succeeded

runic finch
#

If I were you I would create the trip upfront in my database and mark it as pending so that when it's completed, either after the Event is received or the redirect you can "fulfill the order"

#

but otherwise what you said is fine too, store the info in metadata and use that either in the Event or after the redirect

round quail
runic finch
#

yes

round quail
runic finch
#

no you can't change/update the metadata

round quail
#

figured

#

Well thanks, im gonna try that first approach and see where I go

runic finch
#

sure thing!