#daan-webhook-go

1 messages ยท Page 1 of 1 (latest)

hasty whaleBOT
wraith pond
#

Hi, taking a look here

wet pewter
#

Ok, getting this error: Received event with API version 2020-08-27, but stripe-go 74.12.0 expects API version 2022-11-15.

#

But i only see an option for setting a version when using Add an endpoint and not in Test in local environments

wraith pond
#

I'm unsure if the above two are related to each other. You're trying to confirm how you'd pass a specific API version on testing webhook with stripe CLI right?

wet pewter
#

Yes

#

There is an option to set the version here

#

but not here:

wraith pond
#

I'm trying to test this on my end, please give me a few moments.

wet pewter
#

That's okay ๐Ÿ™‚

wraith pond
#

Can you try this?

stripe trigger checkout.session.completed --api-version 2019-09-09

#

you can chance the event to whatever you'd like to listen to

wet pewter
#

Do I need to do this for every event type?

wraith pond
#

yes

wet pewter
#

and i probably need to change it to 2020-08-27 right? Because is just upgraded my sdk to the newest version

wraith pond
#

Yeap!

wet pewter
#

Ok, ran the commands. I'll need a minute to test.

#

I'm still getting the same error unfortunately

wraith pond
#

Ah, you're on stripe-go 74.12.0

wet pewter
#

Yes

#

I ran: ./stripe trigger payment_intent.succeeded --api-version 2022-11-15

#

Maybe change my secret key?

wraith pond
#

I'm getting help as I do not know much about go

hidden abyss
#

๐Ÿ‘‹

#

daan-webhook-go

#

stripe-go is pinned to a specific API version because it's a statically typed library. Basically we have typed classes for every API resources/parameters.
So if you get the Event with version A but your library expects version B, the deserialization could crash. Imagine a property that is a boolean now but was a string before

#

So what you need to do as a developer is make sure that you receive Events formatted with the same API version as your library.

wet pewter
#

Yeah, but how do i change the version?

hidden abyss
#

The "problem" you have is that you use the CLI and it defaults to whatever is the version in your account which is a bit annoying

#

What I usually do is I use a separate test account that I put on the latest API version that way it's easier

#

otherwise you can use ngrok or similar https://ngrok.com/ to forward real Events to your local server (what the CLI does)

wet pewter
#

Isn't there a way to change the API version of my account? otherwise I have to redo a lot of configuration.

hidden abyss
wet pewter
#

I'm still in the testing stage so it's not going to break stuff

hidden abyss
#

I mean you can change the default API version but that will affect prodcuction

#

but yeah if you're just testing on that account and nothing else that's totally easier

wet pewter
#

I'm not in production with this account

hidden abyss
wet pewter
#

Ahh alright, thanks for the help!

hidden abyss
#

that's what my UI says, see the upgrade in the top right? that's what you need to click

wet pewter
#

It say's upgrade is not available in test mode

hidden abyss
#

yeah you have to look at the Live mode one

wet pewter
#

Ahh alright that changes the test mode as well!

#

Very nice, thanks! i should be good now