vue-stripe / vue-stripe-checkout-nuxt-demo

A demo on how to implement vue-stripe-checkout in Nuxt.js
39 stars 12 forks source link

"window.Stripe is not a function" although ssr: false #16

Open hansemannn opened 3 years ago

hansemannn commented 3 years ago

I am trying to integrate the Vue-Stripe library into a PoC project and fail after adding it as a plugin and referencing it in the nuxt.config.ts. The error is:

TypeError: window.Stripe is not a function
    install index.js:1
    use VueJS
    default vue-stripe.js:11
    _callee2$ NuxtJS
    c index.js:1
    _invoke index.js:1
    t index.js:1
    Babel 32
    NuxtJS 12

Stripe should be available via the plugin import, so I am wondering how this can happen. Is the Nuxt integration still meant to work?

T-Zahil commented 2 years ago

Same issue here 🤔

AEGx commented 2 years ago

Same issue here 🎃

nathantsoi commented 2 years ago

From the example, looks like the following needs to be added to nuxt.conf.js (if using nuxt):

script: [
  { src: 'https://js.stripe.com/v3' },
],

Otherwise, just add the stripe js script to your head.