#rwieruch
1 messages · Page 1 of 1 (latest)
Hi
Are you using frontend Stripe SDK? like Android/ios ?
It's a web application with React/Nextjs.
Hi 🙂
My dependencies:
"@stripe/react-stripe-js": "2.1.1",
"@stripe/stripe-js": "1.54.1",
"stripe": "12.14.0",
Thanks for sharing these details,
You may have some Stripe Instance initiated in your integration without version
you need to double check all your envs (local, dev and prod)
This is how I init Stripe on the backend:
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
apiVersion: '2022-11-15',
typescript: true,
});
export { stripe };
And it's the only instance where I use import Stripe from 'stripe'; except for the parts where I import Stripe for TypeScript types.
On the frontend I use:
import {
Elements,
PaymentElement,
useElements,
useStripe,
} from '@stripe/react-stripe-js';
import { Stripe, loadStripe } from '@stripe/stripe-js';
With
const [stripePromise, setStripePromise] =
React.useState<Promise<Stripe | null> | null>(null);
const onceTwo = React.useRef(false);
React.useEffect(() => {
if (onceTwo.current) return;
if (!stripeIntegration) return;
onceTwo.current = true;
setStripePromise(
loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY as string, {
stripeAccount: stripeIntegration.stripeAccountId,
})
);
}, [stripeIntegration]);
and
const stripe = useStripe();
const elements = useElements();
<Elements
stripe={stripePromise}
options={{
clientSecret: stripeClientSecret,
loader: 'always',
}}
>
<PaymentElement />
Do I need to pass the apiVersion somewhere on the frontend libraries too?
For the frontend librairies the API version is pinned you can't update it like the backend
so maybe you migrated or used different Stripe frontend SDK recently
Thanks! I installed all 3 Stripe dependencies 3 months ago. So nothign changed there.
- Would it perhaps help if I upgrade the depnendencies?
- Why is it not possible for me to see the errors (screenshots 1) on the log page (screenshot 2)?
If it matters, I am using Stripe Connect
Would it perhaps help if I upgrade the depnendencies?
If you want to have onyl one version displayed in your dashboard
you need to use a frontend sdk version that matches your backend Stripe API version