Not working for me.
Says 'Stripe is undefined'
And if I do import Stripe from 'stripe' it fires an alert: TypeError: _this4.stripe.redirectToCheckout is not a function.
Then I cloned the repo, tried to run it and upon npm run dev I got an error:
Vue packages version mismatch:
│
│ - vue@2.6.11
│ - vue-server-renderer@2.6.12
│
│ This may cause things to work incorrectly. Make sure to use the same version for both.
│
Then I tried npm run generate so I could run npm run start, and I had the same error. I guess your tutorial is way outta date.
Not working for me.
Says 'Stripe is undefined'
And if I do
import Stripe from 'stripe'
it fires an alert: TypeError: _this4.stripe.redirectToCheckout is not a function.Then I cloned the repo, tried to run it and upon
npm run dev
I got an error:Then I tried
npm run generate
so I could runnpm run start
, and I had the same error. I guess your tutorial is way outta date.Hey there, looks like a race condition, your mounted function is running before the script in head is loaded or it hasn't been called.
Care to show the code?
// eslint-disable-next-line no-undef
stripe.value = Stripe(
'pk_test_ZaFKDdkCzVR4hCmDsUKWodm200fZIzrcmf'
)
OR
check you nuxt.config.js file whether the script is inside the head.
I had the same problem. but I fixed it through my above solution.