简体   繁体   中英

Error when redirection to stripe checkout

I am building out an e-commerce site, with next.js and stripe checkout. I keep running into this error when I am going to checkout. I am using the use-shopping-cart package as well, and I'm starting to think it maybe causing the below response error from stripe-checkout

  "error": {
    "message": "Invalid API Key provided: undefined",
    "type": "invalid_request_error"
  }
}

What is super confusing is that the checkout session in created, along with the cart and payment intent (I know this to be true because I can verify this information thru the stripe dashboard). Currently the stripe dashboard does not indicate there is an error either.

Has anyone experienced this, and does anyone have any idea on how to fix it?

Thanks in advance!

the solution is ridiculously easy. I just needed to prefix my env variable with NEXT_PUBLIC_ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM