Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
274 stars 81 forks source link

Fix: call 'onError' with "Paypal SDK could not be loaded." error #112

Closed holdMyTea closed 1 month ago

holdMyTea commented 3 years ago

In my case, I was able to handle cases when PayPal SDK could not be loaded, but I couldn't prevent an exception being reported to Sentry.

I think it would appropriate to handle this error with the onError prop, as it's meant to catch all exceptions according to the docs:

If an error prevents buyer checkout. This error handler is a catch-all.

Should also help with this issue #40