#_illegal_

1 messages · Page 1 of 1 (latest)

bronze dirgeBOT
stray gulch
#

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)?

fluid spear
#

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?

stray gulch
#

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

fluid spear
stray gulch
#

I don't know what that repo does

#

So can't recommend you use it either way

fluid spear
#

It basically integrated the webhooks with frontend and backend according to the youtube.
I can try checking this ASAP

fluid spear
#

Seems there are some issues with The github link code

stray gulch
#

Yeah that's not our code, so no idea

#

You could just create a test mode checkout session to quickly test this

fluid spear
stray gulch
#

Which part do you need guidance on exactly?

fluid spear
#

How exactly webhooks are being used here?
I dont see any import unlike the previous

stray gulch
#

I don't understand the question

#

What do you mean by import

fluid spear
#

"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

stray gulch
#

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

fluid spear
stray gulch
#

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

fluid spear
#

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? 🤔

stray gulch
#

if you're listening to the same events yeah

fluid spear
#

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?

bronze dirgeBOT
rough shadow
#

Hello! I'm taking over and catching up...

fluid spear
#

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

rough shadow
#

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?

fluid spear
#

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?

rough shadow
#

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.

fluid spear
#

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?

rough shadow
#

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.

fluid spear
#

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?

rough shadow
fluid spear
#

@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?

rough shadow
#

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.