#Skonchy - this.stripe.elements is not a function
1 messages · Page 1 of 1 (latest)
Can you largely make other stripe calls on that page?
Or when stripe.js is included like that?
So I'm still pretty early in the guide and haven't really made any other calls but when I just look at the stripe object printed into the console I see the other properties such as prices etc.
Can you send me the doc you are looking at? Want to make sure I am on the same page
Sure! I've been looking at a handful but looking to replicate something close to this: https://stripe.com/docs/billing/subscriptions/per-seat
What I've gotten to is after setting up the form, connecting Elements to have the card-entry element
Not immediately spotting what this is. Can you send more of your client side stripe code here so I can take a look at it?
sure can I embed in this channel or would you prefer me upload screenshots to imgur or something
StripeJS attached in the entry point
Object created in data of Vue component
I re-initialize it at each point through the lifecycle since I wasn't initially sure if it was a lifecycle issue or not
Template is a basic form with the placeholder divs for elements near the bottom of the form. StripeJS attached again to make sure it was being ran before the template, regardless of the attachment at the entry point
Anything else on the client you want to see?
Thats pretty well it 😛
I think I see an issue in your third snippet.
try var card = stripe.elements().create('card');
Typically in our sample we have it broken out in to its own variable
var elements = stripe.elements();
var cardElement = elements.create('card');```
But I think you need to call it on the result of the function
yeah breaking it up like that still gives me the "this.stripe.elements is not a function"
Interesting. I will reach out to my colleagues who may be more well versed in Vue to see if they have an idea of why that isn't defined there
Have you checked out this third party library? https://stripe.com/partners/vue-stripe
It looks like we don't have an officially way to get elements to work as a Vue component documented.
No worries I'll take a look at Vue Stripe and hopefully it fixes my issue haha. Thanks so much!