gpt4 book ai didi

javascript - Stripe.js 未正确加载

转载 作者:行者123 更新时间:2023-12-01 16:19:08 27 4
gpt4 key购买 nike

我正在将 Stripe 加载到我的付款页面中,如下所示:

<script src="https://js.stripe.com/v3/"></script>

这在我的本地测试环境中完美运行,但在生产中,出现以下控制台错误:
Uncaught Error: It looks like Stripe.js was not loaded correctly
at new e (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at controller-84824401a25a5595fc578f767b4d5c27.js:1
at Object.bnjt (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at t (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at Object.3 (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at t (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at window.webpackJsonp (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at controller-84824401a25a5595fc578f767b4d5c27.js:1

我无法弄清楚可能导致错误的原因。我在生产中使用HTTPS,可以看到JS文件源下载成功。有小费吗?

最佳答案

解决了@NathanCasebolt 的建议。 SO mods 删除了他原来的答案:

“For me, the resolution to this error was as simple as spell-checking my variables. In my backend server code, one of my variables was wrongly capitalized. Since the misspelled variable was part of the function that retrieves my publishable key, the key returned from the server as null. This, in turn, disrupted creation of the Stripe object and threw this error. If I were you, I'd check to make sure (1) that the publishable key on your frontend matches the publishable key in your dashboard, and (2) that you're not doing anything that might disrupt serving this key to Stripe.”

The StackOverflow mods felt this didn’t answer the question and required too much clarification. So, to clarify, the problem for me was this line:

var stripe = Stripe(‘{PUBLISHABLE_KEY}’);

I set things up to retrieve my publishable keys from my server, to give me more flexibility in switching between test keys and live keys. Since my one of my server variables was wrong, I was providing Stripe with a bad key (no key, really), and that’s what threw the error. This is why I suggest you check the publishable key you’re using to create the Stripe object, to make sure that the one you’re using to create the object is there, and that it matches the publishable key you have on your Stripe dashboard."



就我而言,这正是我做错的:在初始化 Stripe 时提供了一个空的可发布 key 。最终,一个非常简单的错误加剧了 Stripe 迟钝的错误信息。

关于javascript - Stripe.js 未正确加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48297274/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com