#paul-geoghegan_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1280484752880570368
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, let me help you with this.
Are you using the Address Element?
There's limited support for something like this. I would say, it's best to limit the allowed countries, and then display an error if they select an area that you can't deilver to.
You can listen to a change event and decide to accept the address or not: https://docs.stripe.com/js/element/events
No, that won't work. I can't limit the countries as people abroad place orders for people here all of the time.
I need to be able to limit things for the shipping and billing separatly.
I also need to limit the state field.
That would also be a terrible user experience.
I would suggest you to implement an address selection on your own. Unfortunately, AddressElement does't support this kind of customization.
Okay, is this something that could be added?
Also, if I did make my own address element could I still store the information in the address object for the payment intent?
Given each company might want to apply custom rules to the displayed addresses, it will be very hard to cover all cases. Countries is just a list of names. But how do you limit the address?
Yes, you can send it along when you confirm the payment: https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-shipping
You just need to be able to put different limits on billing and shipping and then the state field