#Nickolaki

1 messages · Page 1 of 1 (latest)

cerulean wagonBOT
jagged gull
#

Why would you want to prevent this? Which method are you using?

meager ridge
#

Well I don’t really want to redirect to my return URL is payment authentication has failed. Surely it’s better to display the error message prompting the user to re-try authentication.

#

I’m using .confirmPayment

jagged gull
#

Well, yep. You'd do that on the return_url in your confirmPayment Promise chain:

  elements,
  confirmParams: {
    // Return URL where the customer should be redirected after the PaymentIntent is confirmed.
    return_url: 'https://example.com',
  },
})
.then(function(result) {
  if (result.error) {
    // Inform the customer that there was an error.
  }
});```
meager ridge
#

On the failed auth redirect I get these url params, source_redirect_slug & source_type & pi client secret and the pi id.

jagged gull
#

There's no error code/message in the URL params. You use the confirmPayment Promise to check for an error, as per the above

meager ridge
#

I’ve just retested, I’m not getting a promise back when I press fail authentication. It simply proceeds to my return url, it’s correctly showed the error message once out of 10 tries. FYI I’m using the same code in the vanilla js QuickStart.

jagged gull
#

Can you share a reproduction?

meager ridge
#

I can’t 😦 When I hit cancel on the authentication pop up modal I get the correct error message aka “We are unable to authenticate your payment method…” But yeah the fail authentication button’s outcome is still causing a redirect with those weird url params I sent earlier.

jagged gull
#

As explained, that is expected. The return_url is required otherwise how are we to know where to redirect your users back to on success/failure for payment methods that require explicit redirect from your site

#

I'm unsure what the actually is if you're now getting a correct error message in your application