#rafal_api

1 messages ยท Page 1 of 1 (latest)

thick flameBOT
#

๐Ÿ‘‹ 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.

grave belfryBOT
#

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.

sly basin
#

๐Ÿ‘‹ happy to help

#

would you mind sharing a screen recording?

still ruin
#

Yes here is screen

sly basin
#

did you try adding Address line 2?

still ruin
#

I don't know what to write there, this also does not work:

sly basin
#

is this a valid address?

still ruin
#

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);
});

sly basin
#

oh yes

#

this means you only can ship to US

#

and you're choosing a shipping address in Pollen

still ruin
#

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

sly basin
#

what did you pass as allowedShippingCountries?

still ruin
#

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);
    });
sly basin
#

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

still ruin
#

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

sly basin
#

you can use either and both actually

still ruin
#

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

sly basin
#

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

thick flameBOT
still ruin
#

thank you very much

raven stirrup
#

Happy to help.