#jojilede
1 messages · Page 1 of 1 (latest)
that's prod
this is local:
this is stripe elements btw
code:
const getStripe = () => {
if (!stripePromise) {
stripePromise = loadStripe(`${process.env.NEXT_PUBLIC_STRIPE_PUB_KEY}`, {
apiVersion: "2022-11-15",
});
}
return stripePromise;
};
export default function CustomerPaymentsPage() {
const stripePromise = getStripe();
const {loggedUserData, refetchLoggedUser} = useAppContext();
if (!loggedUserData) {
return (
<Layout>
<Spinner />
</Layout>
);
}
if (!loggedUserData?.GetLoggedUser?.UserProfile?.StripeCustomerId) {
return <ActivateCustomerPayments refetchLoggedUser={refetchLoggedUser} />;
}
return (
<CheckoutContextProvider>
<CustomerPayments stripePromise={stripePromise} />
</CheckoutContextProvider>
);
}```
Hi there! Any chance you can log the value of process.env.NEXT_PUBLIC_STRIPE_PUB_KEY to make sure it's being set correctly?
You could also try hard coding your publishable key just to test it out
can the public key be permanently exposed like that?
I think so right
bc it shows up on the network requests anyway?
It can be visible, yep
Still, using an environment variable makes sense so I recommend double checking that the value is being set correctly