#afenster
1 messages ยท Page 1 of 1 (latest)
Hi ๐ you can use the approaches shown here to send/process requests with an API version that differs from the default one for your account:
https://stripe.com/docs/api/versioning
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Pulling in your additional context as that changes the answer:
Especially the calls made using Stripe.js. I'm using the latest versions of stripe-js and react-stripe-js. But the responses I get from Stripe are version 2016 respnnses.
Stripe.js also has the ability to initialize it using an API version that differs from the default for your account:
https://stripe.com/docs/js/initializing#init_stripe_js-options-apiVersion
Thank you. If I want to pass specify the latest version of Stripe.js in the options, what value do I provide? The documentation just says I pass in a string. Is the version just '2022-08-01' ?
Correct, there is no way to pass in a value like latest, you must explicitly tell us which API version that you would like to use by providing it as a string. Yes 2022-08-01 is an example of how to represent our current latest version.
Thank you. Your team has been very helpful.
Still not entirely clear. I'm looking at your sample application for Stripe Payment Element. It has this line:
import {
PaymentElement,
useStripe,
useElements
} from "@stripe/react-stripe-js";
const stripe = useStripe();
const elements = useElements();
stripe.retrievePaymentIntent(clientSecret)
Where do I specify the version? useStripe() takes no parameters. I tried substitututing Stripe()
I'm not sure off-hand how to do that via useStripe, looking to see what I can find.
useStripe() is a hook that gets you the Stripe instance for Elements provider, for setting the API version you would do that via the options parameter when calling loadStripe:
https://stripe.com/docs/stripe-js/react#elements-provider