Closed matejcsok-ee closed 8 months ago
here it says:
Provide initial customer information that will be displayed in the Payment Element. The form will render with empty fields if not provided.
but actually I only see country, even if I specify these defaultValues
const paymentElement = elements.create("payment", {
defaultValues: {
billingDetails: {
address: {
line1: street,
line2: "",
city,
state,
country,
postal_code: zip,
},
},
},
});
paymentElement.mount("#payment-element");
same issue. additionally tried to use the AddressElement, one for shipping and one for billing and it complains that you can only have one address element
Hey there, thanks for the feedback! This is not a bug, but we've also heard that developers would like to use Payment Element and Address Element more flexibly than what is currently supported.
We're working on way to improve this to support more use cases/patterns, but I don't have any specific details or timeline to share yet.
What happened?
I use the
PaymentElement
andAddressElement
inshipping
mode, in which theAddressElement
collects shipping address, and thePaymentElement
shows a checkbox if the billing address is the same as shipping address. If I uncheck the checkbox, it offers me to specify the country, and in some cases postal code (like country US is selected). But I would like to use full billing address. I also see that payment element has default values but if I providebillingDetails.address
and all the fields I still only see the country field.stripe-examples/link - official example It is possible, that it is not a bug, it is just not implemented the way I would prefer to use it, or I just don't understand how to use it. But in my opinion when the billing address is not the same as the shipping address the client should be able to specify the full billing address not just the country. Please let me know which case it is, not implemented, bug or I am stupid. Thank you!
Environment
Chrome 120.0.6099.129 on macos 14.1.2 (23B92)
Reproduction
https://github.com/stripe-samples/link