#melih_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/1301999068997746788
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, can you add more context please and share the request id for this failed payment Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request ?
Unless it's an input validation, it should error out and show the error message if you're making the confirm call.
That works, and the request id for that request please
Code of the whole page (not the prettiest atm dont judge me xD):
req_ZVphD8NmJhTb35
i need help
My try for more context:
The payments work but when i fail a transaction I was expecting it to go into the if statement (to catch the error) so that I could do some additional stuff. But when i fail the transaction it still redirects to the same page
yeah give me skull emoji how clever
this is my ticket boy be gone ๐
ye and
click on what your problem is
@cinder notch looks like you're in the wrong place, this thread is for someone else's question.
- If you have your own thread please chat there.
- If you have a question or a followup to a closed thread use one of the buttons in https://discord.com/channels/841573134531821608/842637025524842496 to get help (we don't reopen closed threads).
Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.
Can you use one of the decline cards and now the 3DS cards, https://docs.stripe.com/testing?testing-method=card-numbers&payment-method=others#declined-payments?
The Payment Intent status is status: "requires_action" which does not mean that it failed
It's rather asking you to complete the next step which is authentication
I might be blind but where is the expiry date and cvc
Oke now it doesnt redirect
Then how i can i do it that it doesnt redirect when it requires action
What do you mean by that?
How/where in the code can i handle the transaction if it requires action
Because it now redirects you to a succes page even though it requires action
I thought that if I click fail payment, that it would be an error and not requiring an action
Do you get it? Sorry not the best at explaining things
Basically I want to execute some code if the user clicks on FAIL test payment
You can do that here: https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment - I followed this integration and the UI shows me an error/ I can add a different card.
Looking at your code now
After you fail the payment, what happens on your page?
After i click on fail test payment it redirects to the return_url
So I have a very simple code:
`if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}`
Your code is hard to parse but can you add something similar to your code?
So after the stripe.confirmpayment() you want me to do this?
Yes so you show the error message for your const { error } = await stripe.confirmPayment code
Because it wont reach it, if i click on fail payment it doesnt go there it redirect to the redirect_uri directly
Like where is your setErrorMessage function?
That should not be the case, on this request, https://dashboard.stripe.com/test/logs/req_ZVphD8NmJhTb35 you're confirming the Payment Intent so you're making the call and hitting that code
I tried it with your code and it does the same:
req_Os2jVj8l8hkqwI
Oh wait, you're using the Deferred Payment intent flow. Please use this code instead: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#submit-the-payment
No idea what that means but ok ill try๐
You're not handling the error on your code, and Defer is just another integration flow where you create the Payment Intent after you collect the payment methods.
Am I not already using that code?
Ok, I need to close this thread soon. I highly reccomend that you use the above code and show the error.
Ok ill try later. Thnx for the help
I think you're following it some, but I could find where you have on your code:
const handleError = (error) => {
setLoading(false);
setErrorMessage(error.message);
}