adrianhajdin / ecommerce_sanity_stripe

Modern Full Stack ECommerce Application with Stripe

Home Page:https://jsmastery.pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'redirectToCheckout') can anyone solve this error

minal322 opened this issue · comments

Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'redirectToCheckout') can anyone solve this error

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.

Have you solved this error I am too facing these, if you had solved it, please let me know