#vivien_api

1 messages ยท Page 1 of 1 (latest)

fervent crescentBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1324662681457786941

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

snow minnow
#

It was a bit complicated to describe the problem with the provided form, tell me if you need more information

pine obsidian
#

๐Ÿ‘‹
Java is a strong typed prog language, so each Stripe version is pinned to the Java SDK version.

#

You need to create a Jar for each Stripe Version

snow minnow
#

๐Ÿ‘‹
That's what we planned to do, a gateway containing every jars, for every versions, and route the request on the good jar depending of the API version, unfortunately we can't get the API version from the api itself, there is no endpoint returning it

pine obsidian
#

Yes, but you in your gateway you should able to surface that information

#

Like a mapping jar -> Stripe Version

snow minnow
#

the mapping would not be a problem I think

#

Let's say a company in the group creates its Stripe account. It will send me its API key and its webhook key. I wouldn't necessarily have access to the Stripe dashboard. How am I supposed to know which API version is used by the account, and therefore which JAR to use?

pine obsidian
#

It will send me its API key and its webhook key
They should send you their desired API version too.

snow minnow
#

You don't think we should be able to get the API version through a request on the API itself

pine obsidian
#

No, because they can use multiple API version at the same time. They are not obliged to use their default API version.

#

Each Stripe Accoutn can use any API version they want.

snow minnow
#

yeah I know but if I don't have access to the account, and I only have stripe api key & webhook key I can't do anything. I mean you tell me each account can chose his api version but that mean if a company tell me "We are using
2024-12-18.acacia" So we're going to write it in hard copy on our side "this company -> this api version -> this jar"

If they update, we will have to edit the code to change the API version manually.

Whereas if we could retrieve the api version directly by making a request, it could be transparent.

pine obsidian
#

if a company tell me "We are using
2024-12-18.acacia" So we're going to write it in hard copy on our side "this company -> this api version -> this jar"
You hardcode just the mapping api version -> Jar
You need to route the request based on the version send in the API and not hard code it

#

If you want to support multiple Stripe Version, you'll need to expose an API for multiple Versions and not encapsulate the API version hardcoded (e.g. by jar).

#

Whereas if we could retrieve the api version directly by making a request, it could be transparent.
Currently this is not supported, because each Stripe Account can use multiple Stripe version at the same time and even within the same integration. If you want to have this limitation by your integration (each Stripe Account must use only one Stripe API version) then you need to track this by your integration/database.

snow minnow
#

you mean the Stripe-version header does force an API version on the account ?

pine obsidian
#

Yes for example, or the same Stripe account may have a bunch of Java microservices which each one uses a different Stripe Java SDK version.

snow minnow
#

mhhh okay

#

So if I set only one JAR version, and I do force the Stripe-Version header in every API calls with the version corresponding to my JAR, I should be fine ?

pine obsidian
#

No, with Java you don't need to set the Stripe-Version header because Java is a strong typed prog lang. In other words, each Stripe version is pinned to the Java SDK and you can't override it, unless you want to create your own http client and call Stripe API directly without using the Java sdk

#

Which is not recommended (you should use Stripe SDK)

snow minnow
#

Does this mean that the header is added/abstracted in the call made through the java sdk ? or there is no header at all specifying the api version through sdk calls ?

pine obsidian
#

Yes it's specified in the header, and you can't override it (there is no public method for this when calling the SDK.)

snow minnow
#

okay, so correct me if I'm wrong, if the stripe account is set up with a more recent version of the API, but the SDK sends an older version, it should work, right?

pine obsidian
#

Yes

#

The default API version at the Stripe Account level is used when there is no API version specified in the API call (Stripe-Version Header)

snow minnow
#

then we should not have any problem then ๐Ÿค” but we had some at some point

pine obsidian
#

What is the issue ? can you share a request Id ?

snow minnow
#

it was a while ago

#

but on the newly created accounts the version of the API was really new, and it was not working with our old sdk

pine obsidian
#

What you mean by it's "not working" ? do you have a concrete example ?

#

Is it with webhooks ?

snow minnow
#

We use a JAR in two distinct project, one which allow us to generate a payment link depending of an API key, and the other one is receiving a webhook request verify the signature, and log the payment complete in a database

#

I think it was a problem on the signature verification, I don't remember exactly

pine obsidian
#

Yes that's possible, because the webhook endpoint APi version must match exacly the Stripe APi version pinned in the SDK

#

Next time, make sure to create the webhook endpoint with the correct API version

snow minnow
#

but we can't create webhooks with older api version so

pine obsidian
#

You can via API.

pine obsidian
snow minnow
#

Okay so I can choose any version with the API call ? Through the developper dashboard I can choose between two

pine obsidian
#

Yes with APi you can choose any version

snow minnow
#

Okayyyy

#

so that's the key to solve my problems ๐Ÿ˜„

#

Thank you !

fervent crescentBOT