Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda