#claeusdev
1 messages · Page 1 of 1 (latest)
hey there!
hello
Those defaults should go in defaultValues in the options rather than fields (which is for controlling when some optional fields are included):
https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-defaultValues
Unless you mean you're trying to control fields appearing, rather than the default values in them, which is driven automatically by the requirements of the selected payment method type
yes i'm controlling fields that appear by default of the selected payment method type
ok that's a bit different than what you first described:
pass some custom default values
But what you're doing is already correct, you just can't force the fields to appear
It's automatic by the payment method type
If you want to collect a full billing address, you can use the Address Element for that:
Alright thanks. Using the address field works for card payment type but i get an extra "full name" field on bank account payment type. Is there a way to get around that?
Are you using billing mode for the address element?
In billing mode, fields should be de-duplicated with the payment element
yes billing mode: <AddressElement options={{mode: "billing", allowedCountries: ['US']}} />
<PaymentElement id="payment-element" options={paymentElementOptions} />
<AddressElement options={{mode: "billing", allowedCountries: ['US']}} />
Hmm and you get a duplicate name field?
Hmm ok I'll need to reproduce that
Alright. thanks
So i found a fix for the duplicates, i set the address field to never in the actual payment element form.
Ah nice, yes that would be one option