#kartik-paymentelement-defaultvalues
1 messages · Page 1 of 1 (latest)
the logs aren't really relevant/don't matter I would say. I'm going to need a more specific details/answer here on what is the problem
you mentioned a 3rd-party, another bug, etc. But I don't really get the question at all right now unfortunately. PaymentElement doesn't even show/collect email/name for card payments for example so I'm not clear what you are really doing, which payment method type(s) we are discussing, what you see on your screen, etc.
kartik-paymentelement-defaultvalues
OK, so I've got a stripe.elements object and am trying to create a payment type element, but pass in default values as options to the email and name fields as in the docs here: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-defaultValues
There's an email field and a name field in the form that gets generated, and I can see that the email is prefilled, but the name input is empty.
Sorry can you be clear/crisp about what you see and the exact payment method type you are looking at please?
👋 stepping in as koopajah needs to step away
A screenshot would indeed be helpful here
As noted, some payment method types don't require name / email at all
I just realized that the email field may be the Link element
So there wouldn't be a field prefilled
Yeah that would make more sense
You can also prefill Link
Sorry, am actively debugging and just commented that part
that works
so it looks like the email option was prefilling the Link element
now if I take the email from prefilling the payment, it may do the trick
Hmmm not exactly sure what you mean by that last part but let me know if I can help
The docs make it sound like email is for the Payment Element though, so you may need to look at that.
Yeah that is just a general reference
I just tried this, to see if I could prefill the name.
const options = {
defaultValues: {
billingDetails: {
name: "Bob"
}
}
}
elements.create("payment", options)
It doesn't seem to work
Yeah I don't know what "doesn't seem to work" means... I need specifics. Many times Payment Element won't have a name field as only very specific Payment Method Types require name
So if you want to share a screenshot of what you are seeing that might help us get on the same page
Okay so that looks like it is potentially a combination of Payment Element and Address Element
As noted -- Payment Element won't require a name here for Card payments
So that is why you don't see anything prefilled when creating your Payment Element
maybe the name is for the Address Element
Yep
I think I still have that underneath
that would make sense
I'm going to spend a few more minutes trying it out, it didn't work first try. I must still be missing something
Sounds good
Thanks for your help. It's working now. I'll make sure the documentation for the 3rd party lib is updated for how to pass these particular fields as default values.