#rafal_api
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/1270701346118701109
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- rafal_api, 1 hour ago, 5 messages
Yes here is screen
did you try adding Address line 2?
I don't know what to write there, this also does not work:
is this a valid address?
yes
maybe it is associated with some settings in Dashboard? I dont know
aah sory
maybe it is because previous example expressCheckoutElement.on('click', (event) => {
const options = {
shippingAddressRequired: true,
allowedShippingCountries: ['US'],
shippingRates: [
{
id: 'free-shipping',
displayName: 'Free shipping',
amount: 0,
deliveryEstimate: {
maximum: {unit: 'day', value: 7},
minimum: {unit: 'day', value: 5}
}
},
]
};
event.resolve(options);
});
oh yes
this means you only can ship to US
and you're choosing a shipping address in Pollen
okay but now I write something like this, it loads some time after clicking Weiter zur Zahlung and after a while still shows that error
what did you pass as allowedShippingCountries?
nothing now, I have it like this: expressCheckoutElement.on('click', (event) => {
const options = {
shippingAddressRequired: true,
shippingRates: [
{
id: 'free-shipping',
displayName: 'Free shipping',
amount: 0,
deliveryEstimate: {
maximum: {unit: 'day', value: 7},
minimum: {unit: 'day', value: 5}
}
},
]
};
event.resolve(options);
});
expressCheckoutElement.on('shippingaddresschange', function(event) {
var resolve = event.resolve;
var address = event.address;
console.log(address);
});
try putting
allowedShippingCountries: ['PL'],
and in your onshippingaddresschange you should choose call event.resolve or event.reject
depending on whether you accept or not the shipping for that address
now I have like that and it works expressCheckoutElement.on('click', (event) => {
const options = {
shippingAddressRequired: true,
shippingRates: [
{
id: 'free-shipping',
displayName: 'Free shipping',
amount: 0,
deliveryEstimate: {
maximum: {unit: 'day', value: 7},
minimum: {unit: 'day', value: 5}
}
},
]
};
event.resolve(options);
});
expressCheckoutElement.on('shippingaddresschange', function(event) {
var resolve = event.resolve;
var address = event.address;
console.log(address);
event.resolve();
});
but I dont know where I should set what countries are valid: in click or also in shippingaddresschange ? it looks like I have to validate it in two places
you can use either and both actually
please read this section https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#collect-shipping in details
but if I set only in click countries like ['PL'] can I just do always resolve in shippingaddresschange ? or still I need to check if it is really PL? It is question if can i trust this: allowedShippingCountries: ['PL'] or still needs to check
the onshippingaddresschange is meant to be used to calculate prices of the shipping and or to validate
but if you don't care about it you don't need to listen to that event
thank you very much
Happy to help.