Open shwao opened 4 years ago
It's an issue, but you don't need the onSuccess
function if you provide the onApprove
function. Just do whatever you want to do inside the onApprove
function.
Anyway, it's a bug and it should be fixed or mentioned in README.md because it's confusing.
Yes, it should be mentioned in the README.md, especially for beginners implementing paypal the first time. I stumbled over this as well.
I discovered that if you specifiy
onSuccess
,onApprove
will not be called. At least this is what is happening for me. I found this part in the code that i dont fully understand. https://github.com/Luehang/react-paypal-button-v2/blob/d819579f77723d2a361476e41e231708a6b8c01c/src/index.tsx#L198 But i think without this ternary:It would work: