#Cvijo
1 messages ยท Page 1 of 1 (latest)
Likely because that's a client-side function, so it uses the browser console to display the error message, rather than sending it to your server
it is client side but your stripe.js did get more detailed error when posting your confrimPayment method
I don't understand. Can you rephrase?
so i have your stripe.js library that i use on website, and i know it will throw error becouse my client_secret is already processed and when i try to confirm it again your client library return error "A processing error occurred." insted of more detailed error ""You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed." so i wanted to show this error to customer insted of "A processinf error occured"
async function confirmPayment(elements) {
const { error, paymentIntent } = await stripe.confirmPayment({
elements: elements,
confirmParams: {
//todo
return_url: 'https://example.com/order/123/complete',
},
redirect: 'if_required'
});
if (error) {
console.log(error.message)
}
return { paymentIntent, error }
}
Are you using your own custom payment form? Or the Payment/Card Element?
can you paste the exact PaymentIntent id here?
"pi_3MswxJIKC68yQBO41RIsBNmL"
i am not sure if we understand eachother ๐ .. i am just wondering why error i got back is generic error when you can send more specific error from your confirmPayment method. Maybe you can fix this in your stipe.js library or it is intended to be generic error on purpose
what's the code where you're displaying the error?
what you mean code, mine client? its angular app if you mean by that
yeah, the frontend code
this is mine confirm payment method i call that return error or payment intent from createPayment method:
async function confirmPayment(elements) {
const { error, paymentIntent } = await stripe.confirmPayment({
elements: elements,
confirmParams: {
//todo
return_url: 'https://example.com/order/123/complete',
},
redirect: 'if_required'
});
if (error) {
console.log(error.message)
}
return { paymentIntent, error }
}
so, stripe.confirmPAyment returns me an error object that has this generic error
gimme a while to get back to you
sure, np
I discussed this with some colleagues and "You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed." is maybe more of a developer-specific error that we didn't want to display to customers client-side. I'll flag this to the relevant team to see if we can provide a better error message in this case. In the meantime though, I can think of one workaround for this that you can consider, the result does still contain the PaymentIntent, so if you see that it's successful, you can provide a different error message telling the user that the payment is already successful
thank you @crude shadow you guys are veery helpfull as always. Your explanation is same i was thinking about its more for developers than end user. Maybe you can return this error as generic and inside another object with something like serverError and inside would be detailed one from your server. But your workaround might work for sure. Thank you again, and thank your colleagues too ๐