简体   繁体   English

使用 Netlify 部署后,我遇到了条带结帐重定向到条带支付页面的问题

[英]I am having an issue with stripe checkout redirecting to the stripe payment page once deployed with Netlify

Hi I am trying to integrate stripe checkout into my webapp.您好,我正在尝试将条带结帐集成到我的网络应用程序中。 Whenever I click on the "purchase button" which is supposed to redirect you to the stripe checkout page, I get this error VM97:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "I have a Node.js & express backend that is handling the api call to stripe每当我单击应该将您重定向到条带结帐页面的“购买按钮”时,我都会收到此错误 VM97:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "I have a Node.js & express backend that正在处理对 stripe 的 api 调用

However, in the localhost environment, I go through the same flow it works perfectly fine just as its expected to.但是,在 localhost 环境中,我 go 通过相同的流程它工作得很好,就像它预期的那样。 It will open up the checkout page with the customers cart.它将打开带有客户购物车的结帐页面。 I only get that error previously stated when deployed.我只在部署时收到前面提到的错误。

This is the api endpoint to handle the response enter image description here这是处理响应的 api 端点enter image description here

This is a call to the api in order to redirect to stripe enter image description here这是对 api 的调用,以便重定向到 stripe enter image description here

I made a few changes to the await function. I was thinking maybe the response was failing before it made it to the final ".then".我对等待 function 进行了一些更改。我在想,也许响应在进入最终的“.then”之前就失败了。 Reason because the error is saying uncaught in promise.原因是错误提示 promise 未捕获。

Your code looks fine.您的代码看起来不错。 The fact it was working on local but failed on deployed environment hints that your deployed environment doesn't have the correct Stripe Secret key, therefore it errored (500) while processing, causing client unable to process the response.它在本地工作但在部署环境中失败的事实暗示您的部署环境没有正确的 Stripe Secret 密钥,因此它在处理时出错 (500),导致客户端无法处理响应。

You would want to debug deeper on your server log to see the detailed error, and also check on your Stripe request log .您可能希望更深入地调试服务器日志以查看详细错误,并检查您的Stripe 请求日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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