#IndyCoder - Versions

1 messages · Page 1 of 1 (latest)

alpine gulch
#

Hello! What's up?

solid hinge
#

In a previous discord, I was told: Okay actually you don't set it with the API key. You set it like \Stripe Stripe:: setApiVersion('2020-08-27' ) ; That will set it globally it

#

So, I'm trying to make sure I've got 2020-08-27 to include with my WordPress plugin. But when I go to Github, there are version numbers, not dates. And the only 2020-08-xx date is 2020-08-28, not 27. So.. confused.

#

And hi, and thanks for being here. 🙂

alpine gulch
#

To clarify, you're building/developing a WordPress plugin?

solid hinge
#

Yes. And the included PHP library has this in the changelog.md:

#

Changelog

7.28.1 - 2020-04-10

  • #915 Improve PHPdocs for many classes
alpine gulch
#

The Stripe PHP library is versioned independently of the Stripe API. You can specify any API version you want when using the PHP library.

solid hinge
#

So, if I setApiVersion to 2020-08-27, will that fail with the PHP library being from 2020-04-10? How do I know which to download and include?

#

I don't want to move fully current, because that will break all my code. Not good with 9K+ users.

alpine gulch
#

The PHP library's version numbers do not use dates, the library is semantically versioned. The current version of the PHP library is 9.3.0. I think you're confusing release dates with versions.

#

If you look in the VERSION file you should find the current version of the PHP library you're using. Generally it should be fine to use whatever PHP library version you want with whatever API version you want. Can you tell me the specific version of the PHP library you're using now?

solid hinge
#

Yeah...7.28.1

alpine gulch
#

You should be able to use that version with API version 2020-08-27, but changing the API version can be risky if you're not careful. Why do you want to upgrade the API version?

solid hinge
#

My users are getting parameter errors.

alpine gulch
#

Is the current version of your plugin not specifying an API version?

solid hinge
#

Stripe support told them to tell me I need to use a much later API, but my last discord discussion resulted in the guidance to use that SetAPI call.

alpine gulch
#

Let's back up a bit, I want to make sure I understand the situation. You have a WordPress plugin you developed which is in use by many users. Some of those users are now getting errors because they're on a newer API version than your plugin supports, and your plugin does not currently specify an API version, so it's using whatever the default is on your users' Stripe accounts. Is that correct?

solid hinge
#

Not exactly. It's not that they are on a newer API (because that API is presumably what comes with my PHP library and the plugin). But when they try to do a transaction with slack, they get parameter errors. Unless … are users each assigned different API versions in their own accounts?

#

Can you see this screengrab:

#

Still there?

alpine gulch
#

Yep, sorry, hang on...

solid hinge
#

K

alpine gulch
#

Okay, so what version of the API did you use when you developed the plugin?

solid hinge
#

Uh, whatever came with the 7.28.1 library.

#

I don't explicitly set a library.

#

Right now, I just set the API key and call checkout.

alpine gulch
#

One thing I want to make clear is that there is no direct link of any kind between a version of the Stripe PHP library and the API version being used. Stripe accounts have default API versions and, if your code is not specifying a specific API version, the default API version on the account will be used.

#

What's happening is that people with their default API version set to something your code doesn't expect is causing the problem.

solid hinge
#

Ah. That explains a lot. So my Stripe account might have a different API version than one of my users.

alpine gulch
#

Exactly.

solid hinge
#

Lightbulb moment.

alpine gulch
#

So what you need to figure out is what API version you developed against, then you need to specify that API version in your code, because that's the API version your code is expecting.

solid hinge
#

I'm only making a very few calls. Is there any way to tell what the API version is that I did develop against?

#

I can dump you the set of checkout parameters as code, if that would help. It's not super long.

alpine gulch
#

What's the default API version on the Stripe account you used to develop the plugin?

solid hinge
#

How do I find that?

alpine gulch
#

The API version section should show which is the default on your account.

solid hinge
alpine gulch
#

Okay, so you probably want to specify 2020-03-02 in your code in that case.

solid hinge
#

So, going all the way back to setApi, use 03-02 as the version. Will that cause issues for newer users?

alpine gulch
#

You should specify that version, test to make sure it works as expected, then release a new version.

#

No, it won't cause issues for new users (it will, in fact, prevent issues for them).

solid hinge
#

"You should specify that version (of the Stripe API?), test to make sure it works as expected, then release a new version (of my plugin?)." Correct?

alpine gulch
#

Yep, correct! Sorry I wasn't more clear there.

solid hinge
#

No problem. Just wanted to make sure I was understanding. You've been hugely helpful. I'll go try it now. THANKS!!!