#guccisofloppy
1 messages · Page 1 of 1 (latest)
Hi 👋 I've never heard of activating an account causing a change to the API version before.
interesting. So, this app has been in development for awhile, and we're approaching a time to launch. I stepped through activation with the company's president, and after that we started seeing 401 errors coming from the React SDK integration. After a bit of bug-hunting, we noticed that on the developer dashboard, we're now getting API hits for 2022-11-15, but our server-side integration sets the API version at 2020-08-27. We're just unsure how that discrepency occured...
are keys tied to the API version?
No, they're tied to accounts. Do you have an example of a request that was made with an API version other than what you were expecting that you can share?
possibly... is there a way to filter the logs by API version?
nevermind, found one
req_m0gbR5jWiZcAgR
You can see that broken down under API version here:
https://dashboard.stripe.com/test/developers
Thanks, taking a look.
That looks like a request made from client-side code via stripe.js. If you want to specify a specific API version there as well as in your server-side code, that will need to be provided while initializing the frontend library via options.apiVersion
https://stripe.com/docs/js/initializing#init_stripe_js-options-apiVersion
awesome, this is what we were looking for
it looks like we are initalizing this from a config.json file, is that "normal" and are there docs for that?
I'm not sure what you mean about initialiazing JS code from a json file.
//BillingDetails.js
...
import { loadStripe } from "@stripe/stripe-js/pure"
import {
Elements,
PaymentElement,
useElements,
useStripe,
} from "@stripe/react-stripe-js"
import StripeConfig from "../../../config/stripe.config.json"
...
export default function BillingDetails() {
const stripePromise = loadStripe(StripeConfig.perishable_key)
...
//do other stripe things
}
I think the "perishable_key" is the "public_key"
//stripe.config.json
{
"perishable_key": "pk_test_51Mmxxxxxxxxxxxxxxxxx"
}
Ah you're using React, you'll pass the API version into the loadStripe function instead
sweet! Thanks, that did fix the API version inconsistency! It didn't fix our errors, but we now think that's due to our React implimentation. Thanks so much for your help!!!
Awesome! Sorry that wasn't the cureall, but glad to hear it's moving you in the right direction!