#_illegal_
1 messages · Page 1 of 1 (latest)
Does the same happen if you generate events via manually testing test flows (ie not using the stripe trigger command and processing a payment in test mode yourself)?
I haven't tested it via the manual flow. I have to integrate the webhooks so was checking if the above works I would have proceeded with the integration manual thing.
To clarify, a manual payment process means making a payment request from the frontend via card elements or payment element, right?
Yeah I just meant running through your app's payment flow in test mode
However it is that you collect payments (whether Checkout, Invoices, payment element, etc)
Just curious if this is a stripe trigger specific issue
I can try cloning the link https://github.com/Vuka951/tutorial-code/tree/master/react-express-stripe/webhooks, updating variables and then trying.
Should I proceed with this?
It basically integrated the webhooks with frontend and backend according to the youtube.
I can try checking this ASAP
Seems there are some issues with The github link code
Yeah that's not our code, so no idea
You could just create a test mode checkout session to quickly test this
https://stripe.com/docs/payments/handling-payment-events
I used the code from here and got 200.
Here we are not using the webhooks import, but the page says triggering actions with webhooks.
Can you guide me on that.
Which part do you need guidance on exactly?
How exactly webhooks are being used here?
I dont see any import unlike the previous
"github.com/stripe/stripe-go/v74/webhook"
and
endpointSecret := "<secret>"
signatureHeader := req.Header.Get("Stripe-Signature")
event, err = webhook.ConstructEvent(payload, signatureHeader, endpointSecret)
I dont see the import and these lines which are essential for webhook as far as I understand
Ah ok
This is what I was driving at earlier by testing your code with a real test scenario. So based off that doc, events sent with stripe trigger won't contain a signature
So that's why they removed the signature verification step
Sorry I haven't actually tested a webhook locally with stripe trigger before, so I had a hunch that was what it was, but his confirms it
Okay,
So let's say I try to test webhook locally, which one should be used?
Additionally, I am trying to test locally. Downloaded code from https://stripe.com/docs/checkout/quickstart
Now, I just simply need to add endpoint for webhook and test it by calling it from UI, correct?
You don't need to call the webhook endpoint at all if you're running stripe listen
It should automatically be called whenever any event you're listening for happens in test mode
Completely up to you
If you want to use stripe trigger, then follow that guide that uses it that you linked
It should automatically be called whenever any event you're listening for happens in test mode
So any call made in test mode when I run stripe listen, will automatically call the webhook? 🤔
if you're listening to the same events yeah
Webhook signature verification failed. Received event with API version 2019-03-14, but stripe-go 74.0.0 expects API version 2022-11-15
Downloaded the prebuilt checkout page code.
And just added the code for webhook endpoint in server.go
Got this when I tried to click on pay.
I got this error when I was trying with stripe CLI so upgraded that.
In frontend, I am not sure about the version. Can you tell how can we resolve this?
Hello! I'm taking over and catching up...
The error message is accurate; the Stripe Go library is pinned to a specific API version and expects Events in that version. You should set up a Webhook Endpoint and set an explicit API version on it to get Events with the correct API version for the library you're using: https://stripe.com/docs/api/webhook_endpoints/create#create_webhook_endpoint-api_version
sorry @rough shadow
But I dont understand the above. We create a webhook using the webhook endpoint but then how to use that particular webhook for listening to events?
Webhook signature verification failed. Received event with API version 2019-03-14, but stripe-go 74.0.0 expects API version 2022-11-15
Can you also provide me how can I resolve this error message? My frontend deos are updated to the latest
My directions above are how to resolve that error. You're getting Events with the wrong API version. You need to set up a Webhook Endpoint with the correct API version.
Not sure I understand the first part, "We create a webhook using the webhook endpoint but then how to use that particular webhook for listening to events?" Can you provide more detail?
By setting up webhook environment, do you mean creating new webhook?
What I meant is we used
event, err = webhook.ConstructEvent(payload, signatureHeader, endpointSecret)
to handle the events. If I setup a webhook by creating it, then how exactly will it help me to listen to events?
The Webhook Endpoint is the configuration that tells Stripe "here's the URL where I want you to send Events". The code you shared above is what you would run at that URL when an Event is received in order to verify the Event came from Stripe and construct the Event object.
So step one is to create a Webhook Endpoint using the API I linked you to above which points to the URL where you want to receive Events and has the API version that matches the one the Go library you're using expects. Then you get your webhook/Event handling code up and running at that URL, then do something that triggers one of the Events you're listening to.
Okay, so
first I create the webhook and lets say keep the URL in Parameters as localhost:4242/webhook
Then you get your webhook/Event handling code up and running at that URL
This means having a /webhook endpoint running at localhost I am guessing.
Triggering means calling the acceptable events list.
Is my understanding correct?
Mostly, but a Webhook Endpoint has to point to a live URL on the Internet, it can't be localhost. You can use a tunnel, like ngrok, to do local testing with a live URL though.
And triggering means doing whatever you would normally do to get the Event to fire.
Okay,
Just one last question.
How exactly do we use the created webhook in our code?
Any particular code or example that you can provide me with?
We have a guide here with some example code: https://stripe.com/docs/webhooks
@rough shadow
I was using the same link and code from here but was facing the errors which I told in thread.
I followed till step3 as it was the point till which local test was done.
I will try to explore some more and play around to see if I can have this working. Thanks
A request: Can this thread remain open for some time? I will surely comment if the issue gets resolved. Till then, can we keep it open?
We don't keep idle threads open, but you're welcome to ask in #dev-help if this thread is closed when you return.
One thing I want to clarify is that you can't use Stripe CLI for this.
You need to specify a specific API version for your Go library, which isn't something Stripe CLI supports.
I think that might be where the issues are coming from.
You need to skip the Stripe CLI parts entirely.