Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'redirectToCheckout') can anyone solve this error
minal322 opened this issue · comments
minal322 commented
Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'redirectToCheckout') can anyone solve this error
Taemin Kim commented
Hi @minal322,
It'd be better if you share your code. In my case, 'stripePromise =' was missing in the getStripe component. After I put that back in place, the error message got disappeared.
const getStripe = () => {
if (!stripePromise) {
stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);
}
return stripePromise;
};
Hope it helps.
Aakash Gupta commented
Have you solved this error I am too facing these, if you had solved it, please let me know