#matt-r_code
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/1288446630638649385
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
As the form would not allow the full code here is what I've got:
expressCheckoutElement.on('shippingaddresschange', async (event) => {
const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({postcode: event.address.postal_code})
};
fetch('/api/checkout/address-validation', options)
.then(response => response.json())
.then(response => {
if (response.success === true) {
event.resolve();
} else {
event.reject({
shippingRate: [],
});
}
})
.catch(err => console.error(err));
});
Hi, let me help you with this.
Thank you, this is specifically relating to the express link element
I don't think you can pass anything in reject payload: https://docs.stripe.com/js/elements_object/express_checkout_element_shippingaddresschange_event
Ah no you can't that was a hang over from testing.
So what's your challenge exactly?
That updated code looked to work, has it recently changed?
Apologies for the late reply.
Previously when I attempted to set via the async method it would not respond
I don't understand what you mean, sorry.