#marcoBach
1 messages · Page 1 of 1 (latest)
Hi there
You want to listen for the .on('ready' event: https://stripe.com/docs/js/element/events/on_ready
Hi
That will let you know when Payment Element is fully rendered
In terms of knowing whether a wallet was displayed... hmm
I used those event listener, but the event happen before the wallet button is fully displayed
Ah interesting... that is likely because the canMakePayment stuff is running under the hood to check on the customers wallet
Can you tell me more about your use-case?
What are you doing once it is loaded?
at this moment the on ready event was already received
and after a while I have this:
Hmm yeah I am seeing the same thing from a quick test with a breakpoint
I do feel like that is wrong and we are firing that too early here... I'll need to provide some feedback internally about this
In this scenario the google pay is not configured so the button is not showed in paymentElement, but I haven't this info so display the label 'Select a payment method' incorrectly.
Yeah makes sense. Give me a moment
Try using the change event instead of the ready event
Ah actually that will only have the currently selected payment method type
Not the list
Hmmm
I'm not sure there is a way to do this. Let me check with a colleague
Yes I've tried to use also the change event but as you said there is not information I need
Yeah okay I confirmed that unfortunately this isn't really possible right now.
I'll submit a feature request to get this added
But for now you won't want to dynamically show text based on what is rendered
ok, and for the ready event generated too early ?
Well I think that is all a matter of perspective. I'll include that as feedback but will have to check with the Eng team for whether that is intentional or not.
I agree with you though that we should probably be holding off on that until the actual types are fully rendered as opposed to just the skeleton
Ah wait a second
I think you can manage that actually via the loader on your elements object: https://stripe.com/docs/js/elements_object/create#stripe_elements-options-loader
I haven't messed with that in a while
Let me check
Yep if you set that to never then you won't see the skeleton
And it should all load at once
Ok, It's an options to set on the <Element ...> components, right ?