#blakemaczka

1 messages · Page 1 of 1 (latest)

worthy brookBOT
proven mauve
#

I'm looking at this documentation https://stripe.com/docs/tax/custom#calculate-tax which says you can "recalculate tax as your customer types their billing or shipping address" but it doesn't mention the payment element supporting that or give an example

late scroll
#

Payment Element only supports collecting billing address and it doesn't collect full address all the time. Billing address is only collected when necessary in Payment Element and it might not be full address.

One way I can think of is to use Address Element to collect the address: https://stripe.com/docs/elements/address-element

When the address is entered, element.getValue() callback on Address Element can be used to get the address and re-calculate the tax: https://stripe.com/docs/js/elements_object/get_value_address_element

After the tax is re-calculated, then you can show the tax information, update payment intent amount and enable the payment button

proven mauve
#

Thanks for looking into this. Is it possible to grab just the zip code from the payment element after its been entered but before payment has been submitted? Can I get that value as they type it or does it need to be an address element to do that?

late scroll
#

I'm afraid Payment Element doesn't support callback to retrieve the zip code before submitting the payment. Address Element is the only option

proven mauve
#

Okay got it, thank you