简体   繁体   中英

Stripe Firefox Chrome Extension redirect url not working

Seems like this question has been asked plenty of times, but every time has slightly a different answer that isn't applicable. I am taking a chrome extension and trying to port it to Firefox. It is a react-app that uses an HTML page to load my App.js.

my manifest.json:

  "web_accessible_resources": ["images/*"],
  "content_security_policy": "script-src 'self' https://apis.google.com/; script-src-elem https://js.stripe.com; object-src 'self'"
}

my HTML file:

...
  <div id="root"> </div>
  <script src="https://js.stripe.com/v3/"></script>
  <script src="App.js"></script>
</body>

my App.js file:

import { loadStripe } from "@stripe/stripe-js";

 if (sessionId) {
        // We have a session, let's redirect to Checkout
        // Init Stripe
        const stripe = loadStripe(STRIPE_PUBLISHABLE_KEY);
        stripe.redirectToCheckout({ sessionId });
      }

It fails because it keeps saying the following error: 错误信息截图

I cannot figure out what the issue is and would love some help!

当我删除 apis.google.com 时,这个问题得到了解决——以防将来有人需要这个,然后 Stripe 开始工作。

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