Open grzkracol opened 3 weeks ago
@paypal/react-paypal-js, ver 8.1.3
In Mozilla Firefox(130.0) onClick event is raised after Paypal Popup window is opened.
Here's the example code we use in our system to render paypal buttons.
<PayPalScriptProvider options={{ clientId: response.ClientId, currency: response.Currency, }} > <PayPalButtons style={{ layout: 'horizontal', color: 'black', height: 48, shape: 'rect', tagline: false, }} onApprove={(data, actions) => onApprove( data, actions, response.PaymentProviderId ) } createOrder={() => createOrder(response.PaypalOrderId) } onClick={(data, actions) => { if (window.validateAcceptTermsCheckbox()) { return actions.resolve(data); } return actions.reject(); }} /> </PayPalScriptProvider>
This code works perfectly fine for Chrome and Edge browsers. But runs incorrectly for Firefox.
Paypal modal window is opened, then (because window.validateAcceptTermsCheckbox() resolves to false) the popup is closed. That looks unprofessional.
onClick is fired before the popup is opened. So the code has a real chance to run some validation and decide whether to open the modal or not.
Add any other context about the problem here.
Library used
@paypal/react-paypal-js, ver 8.1.3
π Describe the Bug
In Mozilla Firefox(130.0) onClick event is raised after Paypal Popup window is opened.
π¬ Minimal Reproduction
Here's the example code we use in our system to render paypal buttons.
This code works perfectly fine for Chrome and Edge browsers. But runs incorrectly for Firefox.
π Actual Behavior
Paypal modal window is opened, then (because window.validateAcceptTermsCheckbox() resolves to false) the popup is closed. That looks unprofessional.
π€ Expected Behavior
onClick is fired before the popup is opened. So the code has a real chance to run some validation and decide whether to open the modal or not.
π Environment
β Additional Context
Add any other context about the problem here.