vue-paypal-checkout icon indicating copy to clipboard operation
vue-paypal-checkout copied to clipboard

is there an event for errors?

Open pixelpaulaus opened this issue 6 years ago • 4 comments

seems like there is no way to catch errors, such as "DUPLICATE_TRANSACTION"? Unless i am mistaken?

pixelpaulaus avatar Apr 23 '19 05:04 pixelpaulaus

I would also like to know how to handle errors with this package. I know that there's payment-authorized, payment-completed, and payment-cancelled events. But what about one for errors? Even a generic one would be nice.

Is there a way to do this?

JuanGongora avatar Jul 30 '19 15:07 JuanGongora

Possible solution made in this PR: https://github.com/khoanguyen96/vue-paypal-checkout/pull/90

The underlying dependency paypal-checkout has an onError event that simply wasn't tied into before. It should allow you to catch any errors in checkout process. However I noticed identifying the exact underlying error maybe somewhat impossible (for example if it were actually a DUPLICATE_TRANSACTION). I was only able to confirm my own errors were DUPLICATE_TRANSACTION by using the dev console in Chrome open and noticing the last failed XHR network request to paypal returned that in its response. The object you get from the onError event only has a message property filled with a very boring stacktrace (and no real mention of the failed response code). But you can at the least notify end-use there was an error.

nicholi avatar Aug 18 '19 09:08 nicholi

Apparently the lack of useful error object is a known thing, semi-discussion in this issue: https://github.com/paypal/paypal-checkout-components/issues/479

nicholi avatar Aug 18 '19 09:08 nicholi

I missed the big Note in the official docs, https://developer.paypal.com/docs/checkout/integration-features/handle-errors/.

Just a very general event.

nicholi avatar Aug 18 '19 09:08 nicholi