#_liamm3
1 messages · Page 1 of 1 (latest)
Hmm is that Express Checkout Element? I think Express Checkout Element only has wallet buttons
If that's normal Payment Element, try the fetch_updates method https://stripe.com/docs/js/elements_object/fetch_updates
Yes, it's the Express Checkout Element. Here is the code for calling our backend
expressCheckoutElement.on('shippingaddresschange', async (event) => {
const address = event.address;
console.log("Address changed:", address);
console.log('event', event);
const res = await fetch('/actions/api-module/stripe-express/update-address', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
address,
sku: {{ product.defaultVariant.sku }},
}),
});
const payload = await res.json();
const resolve = event.resolve;
orderId = payload.orderNumber;
resolve({
lineItems: payload.displayItems
});
});
And this is an example response, when a user selects an UK address:
{
"id": 20702,
"displayItems": [
{
"name": "Advanced Cream",
"amount": 6600
},
{
"name": "19 % MwSt. Entfernt",
"amount": -1054
},
{
"name": "0 %",
"amount": 0
}
],
"total": {
"label": "Insgesamt",
"amount": 5546
},
"shippingOptions": [
{
"id": "standard",
"label": "Standard",
"amount": 0
}
],
"orderNumber": "e44c9e0d46903a44df49edc46f464f28",
"status": "success"
}
Can you still try the fetch_updates function above?