#vish_code
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/1337008097360744460
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Adding more context here, my requirement is:
When I click on a button "Continue with link" I want to display this:
When I click on continue without link, I want to display this:
I am unable to display just the payment element
What do you mean by this exactly?
When my page is loading, initially I am hiding Link. But still I am getting saved payment methods on my screen:
I want this screen on load
Is that achievable?
I have a button called "Continue with link" only if user clicks on that, I should display the other screen
This email field shouldn't be displayed if loadLink in your code is false. Are you sure it's the case?
No, I am talking about your own variable which hides the LinkAuthenticationElement component. If the component is not rendered, you're not supposed to see the email field above the Payment Element
I am using a state variable to handle this: {linkMode && ( <LinkAuthenticationElement id="link-authentication-element" onChange={handleLinkAuthenticationChange} options={{ defaultValues: { email: email } }} /> )}
linkMode is set to false by default
so it should not render right?
But in my case, even when LinkAuthenticationElement is not rendering, I am able to see this saved methods
This doesn't look right. What happens when you clear the email? Does the email field disappear?
You should be able to debug this by checking the source code of the page. Do you see the component being rendered when this is displayed?
The LinkAuthenticationElement is not loading, but the PaymentElement loads this component automatically
As an alternative, is there any way for us to detect if the user is already having an active Link session?
does payment element return any info in any callbacks?
hi! I'm taking over this thread.
Hey soma!
your goal is to programatically disable Link in the Payment Element?
Yes. Dynamically enable/disable
I am able to hide the Link element dynamically, but when there is an active Link session, I am seeing the screen in above screenshot
If that is how it is expected to work, I would need to hide some of my components if there is an active session, But I don't see any way to detect it
I can give you more context if you need
do you have a link where we can reproduce the issue?
ah unfortunately no it's my local :/
It would help if I know if there's a way to detect an active link session too
Does Payment element have any callback for that?
if there's a way to detect an active link session too
no that's not possible.
I think what you are trying to do is not possible. if you enabled Link on your Stripe account, and a user is already athenticated with Link, then it makes sense that the Payment Element will show the saved card of the customer