-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Bug report #559
Comments
Happens in Doesn't work like the documentation states in https://developer.paypal.com/docs/checkout/standard/customize/validate-user-input/#asynchronous-validation- Our use-case is that we want the payment button to be enabled to always trigger form validation on-click and prevent popup-opening if there are issues. Example: <PayPalButtons
fundingSource={FUNDING.PAYPAL}
key={FUNDING.PAYPAL}
disabled={shouldDisableBuyNowBtn}
createOrder={createPaypalOrder}
onCancel={onPaypalCancel}
onApprove={onPaypalApproveOrder}
onError={onPaypalError}
onClick={(data, actions) => {
console.log('Paypal onClick');
return new Promise((resolve, reject) => {
console.log('Faking async validation delay 1000ms')
setTimeout(async () => {
console.log('Issue rejection');
await actions.reject();
reject();
}, 1000);
})
}}
/> |
@renarsvilnis because of Transient User Activation we always have to open the popup when the buyer clicks on the PayPal button. If we delay opening the popup, some browsers will treat it like an unwanted popup ad and block it. If you return |
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.
The text was updated successfully, but these errors were encountered: