#kartik-paymentelement-defaultvalues

1 messages · Page 1 of 1 (latest)

vivid laurelBOT
undone crow
#

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

vivid laurelBOT
late night
#

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.

undone crow
#

Sorry can you be clear/crisp about what you see and the exact payment method type you are looking at please?

small cobalt
#

👋 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

late night
#

I just realized that the email field may be the Link element

small cobalt
#

So there wouldn't be a field prefilled

#

Yeah that would make more sense

#

You can also prefill Link

late night
#

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

small cobalt
#

Hmmm not exactly sure what you mean by that last part but let me know if I can help

late night
#

The docs make it sound like email is for the Payment Element though, so you may need to look at that.

small cobalt
#

Which docs?

#

Certain payment methods do require email

small cobalt
#

Yeah that is just a general reference

late night
#

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

small cobalt
#

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

late night
#

This is the generated form. I expect to see "Bob" at the Full Name.

small cobalt
#

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

late night
#

maybe the name is for the Address Element

small cobalt
#

Yep

late night
#

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

small cobalt
#

Sounds good

late night
#

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.