Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
How to get functions from a url <script> tag

In my Next JS app, I have an app.tsx page where external scripts are loaded as such

<Head>
   <script src="https://js.stripe.com/v3/"></script>
   ...other scripts and stuff
</Head>

The Stripe() function is loaded with the url, and I can access it's properties that work just fine, like:

Stripe("publishable key").redirectToCheckout({sessionId: 'sessionId'})

But when I attempt to build my app, I get this error:

ReferenceError: Stripe is not defined

And before you ask, the Stripe npm package is for backend code with the non-publishable key, so that won't work. But I need a way of importing the stripe script from the URL while defining the Stripe function so it isn't undefined.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Change Stripe to window.Stripe in your code may fix it

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!