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
273 stars 81 forks source link

Customer pays with Paypal and immediately leaves the website causes him not to get the item #66

Open ErezShahaf opened 4 years ago

ErezShahaf commented 4 years ago

I was testing a few things on my Sandbox account and realized that if the customer pays, there is a window of about 3 seconds until the success function fires

onSuccess={() => { this.props.handlePaymentComplete(); }} The problem is, if the customer pays and quits my website in that 3 seconds window, he will be charged the money but the function will not fire and therefore his information will not be saved to the DB.

I'm pretty sure that it is a problem with the react-paypal-button-v2, but I couldn't find a decent way to connect paypal with react. Is there a way to solve this issue?

PrestonPHX commented 4 years ago

I answered this here, but to fix this for other users I recommend removing the onSuccess example and having a default (not commented out) example with onApprove patterned after this official native JS sample: https://developer.paypal.com/demo/checkout/#/pattern/client

mageshwarang commented 10 months ago

@PrestonPHX I have a similar problem upon using the onSuccess(..) method. Not all payments are getting thru this issue. Only certain payments (probably mobile payment) are getting this issue. The payment gets processed successfully on PayPal end, but the callback is not happening to the onSuccess(..) method and resulting in refund / chargeback.

Will the onApprove(..) method resolve it 100%. Also, I am using the 2.4.0 version of your library. Upgrading it to 2.6.3 will make any changes are improvements? Kindly let me know.

mageshwarang commented 10 months ago

I was testing a few things on my Sandbox account and realized that if the customer pays, there is a window of about 3 seconds until the success function fires

onSuccess={() => { this.props.handlePaymentComplete(); }} The problem is, if the customer pays and quits my website in that 3 seconds window, he will be charged the money but the function will not fire and therefore his information will not be saved to the DB.

I'm pretty sure that it is a problem with the react-paypal-button-v2, but I couldn't find a decent way to connect paypal with react. Is there a way to solve this issue?

@ErezShahaf Did the solution work for you?