Open pixelpaulaus opened 5 years ago
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?
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.
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
I missed the big Note in the official docs, https://developer.paypal.com/docs/checkout/integration-features/handle-errors/.
Just a very general event.
seems like there is no way to catch errors, such as "DUPLICATE_TRANSACTION"? Unless i am mistaken?