#melih_code

1 messages ยท Page 1 of 1 (latest)

agile frigateBOT
#

๐Ÿ‘‹ 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.

jade shoal
#

Unless it's an input validation, it should error out and show the error message if you're making the confirm call.

feral magnet
#

What can i do for more context.

#

Just send my code?

jade shoal
#

That works, and the request id for that request please

feral magnet
#

req_ZVphD8NmJhTb35

cinder notch
#

i need help

feral magnet
#

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

cinder notch
#

yeah give me skull emoji how clever

feral magnet
cinder notch
#

how do i get one

#

tf how did i get here

feral magnet
cinder notch
#

ye and

feral magnet
#

click on what your problem is

agile frigateBOT
#

@cinder notch looks like you're in the wrong place, this thread is for someone else's question.

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.

jade shoal
#

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

feral magnet
#

I might be blind but where is the expiry date and cvc

jade shoal
#

you can pass any date in the future

#

any anumber for cvc

feral magnet
#

Oke now it doesnt redirect

#

Then how i can i do it that it doesnt redirect when it requires action

jade shoal
#

What do you mean by that?

feral magnet
#

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

jade shoal
#

Looking at your code now

#

After you fail the payment, what happens on your page?

feral magnet
#

After i click on fail test payment it redirects to the return_url

jade shoal
#

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?

feral magnet
#

So after the stripe.confirmpayment() you want me to do this?

jade shoal
#

Yes so you show the error message for your const { error } = await stripe.confirmPayment code

feral magnet
#

Because it wont reach it, if i click on fail payment it doesnt go there it redirect to the redirect_uri directly

jade shoal
#

Like where is your setErrorMessage function?

feral magnet
#

I tried it with your code and it does the same:
req_Os2jVj8l8hkqwI

jade shoal
feral magnet
#

No idea what that means but ok ill try๐Ÿ˜†

jade shoal
#

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.

feral magnet
jade shoal
#

Ok, I need to close this thread soon. I highly reccomend that you use the above code and show the error.

feral magnet
#

Ok ill try later. Thnx for the help

jade shoal
#

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);
}