#bcflynn2_api

1 messages ยท Page 1 of 1 (latest)

quartz yarrowBOT
#

๐Ÿ‘‹ 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.

reef crag
#

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?

coarse wave
#

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:

reef crag
#

and where's your code for creating the confirmation token?

coarse wave
#

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.

reef crag
#

Gotcha - still trying to think of what this could be

coarse wave
#

Thanks karbi!

reef crag
#

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

coarse wave
#

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 :/

reef crag
#

And what about the this.stripe.getInstance() ?

coarse wave
#

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.

reef crag
#

Just to try something out - can you add a call to elements.getElement('payment'); before calling createConfirmationToken and see what you get back?

coarse wave
#

Yep! I tried that already- it's there. 1 sec, I'll show you.

#

And this is returned from that call.

reef crag
#

Really quick, what happens if you do this.stripe.createConfirmationToken() (removing the getInstance())

coarse wave
#

That's the object, unfortunately. Doesn't compile- that's the wrapper from ngx-stripe

reef crag
#

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() ?

coarse wave
#

No worries. ngx-stripe has a servioces that contains the stripe.js service, That's the getinstance

#

import { StripeService, StripeServiceInterface } from "ngx-stripe";

reef crag
#

Gotcha, but that still doesn't really tell me why you need getInstance in some places, but not others?

coarse wave
#

I can try to jetison the wrapper?

#

The getInstance is set to a variable, that's why, btw ๐Ÿ™‚

quartz yarrowBOT
crisp jasper
#

Hey there, just stepping in as my teammate needs to head out

#

Reviewing the discussion now

coarse wave
#

Thanks synthrider!

crisp jasper
#

How does this compare to the example they provide?

#

It seems like perhaps there is a mismatch in the stripe instance and the elements

coarse wave
#

They usually use an element that does the mounting behind the scenes

coarse wave
#

Let me try to remove the ngx-stripe library enmtirely and just use the stripe.js. That will at least remove that unknown.