#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/1271052305159950409
๐ 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.
๐ happy to help
I was that but where exactly it is?
I saw*
expressCheckoutElement.on('click', (event) => {
const options = {
emailRequired: true,
phoneNumberRequired: true
};
event.resolve(options);
}); somehwere here?
where exactly, what property
but can i get this somewhere here: expressCheckoutElement.on('shippingaddresschange', async function(event) {
try {
var resolve = event.resolve;
var address = event.address;
const response = await fetch(checkoutDataUrl, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
country: address.country,
provider: providerName
})
});
const data = await response.json();
if (data.valid) {
resolve(data);
} else {
event.reject();
}
} catch (error) {
}
});
I have here url ajax for my endpoint and I need to save it during address changing
whenever client fill correctly address I am saving all and I want to save also email and his name
but then, not when he clicks confirm
please give me a second I'm just testing something
okay
so basically when you do the onclick handler you need to pass the emailRequired: true option to the resolve
I did: expressCheckoutElement.on('click', (event) => {
const options = {
emailRequired: true,
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);
});
but here on the shippingaddresschange
I need to have somewhere that email to send it to my endpoint
how to do that?
and after you need to listen to the onconfirm handler and you will get the email in the billing details
where, here: expressCheckoutElement.on('confirm', async (event) => {
const { error } = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: returnUrl,
},
});
if (error) {
console.error(error);
} else {
console.log('Payment successful');
}
}); ?
ok looks like i cant do it in same endpoint
in the event you have access to billingDetails