#vitor-paixo_code
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/1291032172073062495
📝 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.
- vitor-paixo_best-practices, 11 minutes ago, 27 messages
- vitor-paixo_best-practices, 1 day ago, 10 messages
Hello
I don't believe there's a list or resource that outline which errors are handled automatically. If the error can't be handled by PaymentElement, it is usually returned with the PaymentIntent associated with the failed payment under last_payment_error - https://docs.stripe.com/api/payment_intents/object#payment_intent_object-last_payment_error
When the customer gets redirected to the return_url, you can check if PaymentIntent errored and if so, you can check the last payment error parameter to find the error message
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
How can I distinguish between the errors that should be handled manually and those that are already displayed directly by the Stripe Payment Element component? It doesn’t make sense to handle errors that the component itself shows to the user, but it’s crucial to handle those that aren’t displayed for better user experience and to avoid issues during payment.
Regarding the redirect, how can I validate the payment intent after the page refreshes? When redirected, the URL contains three query parameters, and I lose access to the payment intent. Is it possible to retrieve the necessary information from any of these query parameters?
Yup, you can retrieve the PaymentIntent object using the client-secret using Stripe.js
https://docs.stripe.com/js/payment_intents/retrieve_payment_intent