#rpatel8457
1 messages · Page 1 of 1 (latest)
Hello rpatel8457, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• rpatel8457, 1 day ago, 5 messages
Hi there 👋 yes, you can build that logic, but it's not prebuilt and not available in the Payment Element alone.
You can listen to the change events that the Payment Element emits, and conditionally show an address form when you detect the customer has selected afterpay.
https://stripe.com/docs/js/element/events
You could use our Address Element there instead of building your own address form:
https://stripe.com/docs/elements/address-element
The one issue I see with the address element is that its getting the name and email again. And there is no way to hide those.
It will need to collect name again, or you'll need to add logic to collect a name once and provide it as both the name for the billing details and the shipping address details.
You can't suppress those fields in the Address Element, but you can suppress their collection in the Payment Element by setting those to never inside of the fields.billingDetails hash:
https://stripe.com/docs/js/elements_object/update_payment_element#payment_element_update-options-fields