#bcflynn2_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1240716508766670869
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Do you have a site I can take a closer look at? and some code snippets that show how you're initializing + mounting the elements + creating the confirmation token?
We don't have a live site yet; I'm doing this locally. But sure- hang on.
It's an Angular application, so there's some noise, but here's the relevant information:
and where's your code for creating the confirmation token?
That's in a serice; I execute the proise and so a bunch of stuff after that that we need to do to save the data on our end.
Gotcha - still trying to think of what this could be
Thanks karbi!
Can you tell me a little bit more about what the .subscribe() is doing? My guess is that something is off in the timing there - either that or you're mounting the elements to a different elements object than the one you're using to create the confirmation token
Yep- that subscribe is after success of initializing the elemnts. It's a JavaScript promise. I can breakpoint and the element does get mounted, and is there in the elements.elements object when calling the createConfimationToken. Which I can't figure out :/
And what about the this.stripe.getInstance() ?
That is grabbing the stripe.js service from an Angular library called ngx-stripe. I have bypassed all the niceties from that Angular component and just using the stripe.js instance to try to debug this.
Just to try something out - can you add a call to elements.getElement('payment'); before calling createConfirmationToken and see what you get back?
Yep! I tried that already- it's there. 1 sec, I'll show you.
And this is returned from that call.
Really quick, what happens if you do this.stripe.createConfirmationToken() (removing the getInstance())
That's the object, unfortunately. Doesn't compile- that's the wrapper from ngx-stripe
Sorry if this is a silly question - why do you need getInstance() before calling create confirmation token, but you don't need it in your call to this.stripe.elements() ?
No worries. ngx-stripe has a servioces that contains the stripe.js service, That's the getinstance
import { StripeService, StripeServiceInterface } from "ngx-stripe";
Gotcha, but that still doesn't really tell me why you need getInstance in some places, but not others?
I can try to jetison the wrapper?
The getInstance is set to a variable, that's why, btw ๐
Hey there, just stepping in as my teammate needs to head out
Reviewing the discussion now
Thanks synthrider!
I am also confused about the pattern here, since we're not familiar with the internals of ngx-stripe
How does this compare to the example they provide?
It seems like perhaps there is a mismatch in the stripe instance and the elements
They usually use an element that does the mounting behind the scenes
Let me try to remove the ngx-stripe library enmtirely and just use the stripe.js. That will at least remove that unknown.