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

[BUG] Incorrect logic on createOrder call #82

Open sappster opened 4 years ago

sappster commented 4 years ago

To Do First

Software Package Version: 2.6.2

Describe the bug The logic for createOrder ternary should not rely on amount prop. Causes an error when amount and createOrder are both undefined.

https://github.com/Luehang/react-paypal-button-v2/blob/d819579f77723d2a361476e41e231708a6b8c01c/src/index.tsx#L189

To Reproduce

Uncaught TypeError: createOrder is not a function **Expected behavior** Coerce the amount to $0 or catch the exception and provide a more robust error **Desktop (please complete the following information):** - OS: windows - Browser: chrome 84.0.4147.125 - React Version: 16.8.4