#Blitoka33
1 messages ยท Page 1 of 1 (latest)
Hello ๐
With PaymentElement, you would create a PaymentIntent server-side and send the clientSecret to client-side which then is used to render the element.
Then you'd use PaymentElement to collect the payment method information (your customer would put this information in) and once they're done, you'd confirm the PaymentIntent client-side
We have docs on this flow here
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
If you have any specific questions around it, I'm happy to help ๐
I got to this point, but for some reason the client just doesnt pass the informations.
I can share the code if you need.
Sure thing!
async function handleSubmit(e) {
e.preventDefault();
setLoading(true);
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: "http://localhost:3000/checkout.html",
receipt_email: emailAddress,
},
});
if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}
setLoading(false);
}
Can you move setLoading(true) a little further down? Preferably after confirmPayment(...)
Do you see any error messages in your console?
Instead of
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}```
Can you just do `showMessage(error)` and see if you find anything?
Nothing happened.
Weird, it seems like the function doesn't get executed.
let me check
Nope it doesn't run, I need to check my code then
๐
SetLoading isn't defined
I skipped something in the docs
wait
Now it works, awesome. My code was a bit messed up, but I managed to get it fixed, thanks for the help!
NP! ๐ Happy to help