#theruv
1 messages · Page 1 of 1 (latest)
👋 happy to help
would you mind elaborating on what you're trying to achieve exactly?
I'm initializing elements in the background, and when a user submits a form with their email, I reveal the payment elements. However I want to prefill the email that was just submitted so it doesn't need to be typed twice.
Apologies, I'm using the linkAuthentication element to capture email
I can usually do this via elements.getElement("payment").update({
layout: "tabs",
defaultValues: {
billingDetails: {
email: document.getElementById("email").value,
},
},
paymentMethodOrder: ["card", "apple_pay", "google_pay"],
});
However, it is not consistently reliable. Sometimes, it doesn't work, leaving the linkAuth email field empty
that makes more sense now
let me take a look if there's a way to this differently
Thank you
One note: I only get access to my email after I initialize elements
what's your constraints there?
Customer submits email -> they say payment form.
I'm trying to ensure paymentElement (hidden) is initialized before they submit (reveal pre-rendered payment form)
I'm using defferedPaymentIntent method so it shouldn't have any negative impact. I usually only render the form when it's highly likely user will want to checkout. Is there a way to add email programatically?
I'm using defferedPaymentIntent method so it shouldn't have any negative impact
regardless
we recommend creating and mounting the elements when needed
rather than pre-initializing them
Wouldn't this add a slight delay for the user? How would you solve for this?
not really