#run-webhook-signature
1 messages ยท Page 1 of 1 (latest)
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
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?
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"
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?
correct
Alright, ill go over my env variables
I have one more question should i ask here or start a new thread?
It was my env variables ๐
haha I should add "env variables" as another common cause ๐
and you can just ask your other question here!
lol, really should
So the way i currently have my app set up is i create a trip once the payment completes, is it possible for me to return the createdTrip object from the webhook? I want to know the id of the trip that was just created
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
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
yes!
or just pass metadata of some "trip ip" in metadata and load that from your database
trip id?
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
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?
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
youre good, can only imagine helping so many people at once
but my trip gets created in the webhook
but why?
I only want the trip to be created once the payment succeeded
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
Have status as "pending" then once the payment succeded update it to "paid"?
yes
would this mean i would have to update the metadata in my webhook?
no you can't change/update the metadata
sure thing!