MozillaFoundation / donate-wagtail

[Legacy] - Wagtail based donation stack
Mozilla Public License 2.0
43 stars 22 forks source link

Paypal window does not appear, and donate page shows error message #1635

Closed danielfmiranda closed 2 years ago

danielfmiranda commented 2 years ago

Tasks:

The issue

the issue presents before the donation is made - so after entering a value into donate other amount field, which is under $10 then clicking the Paypal button - the Paypal popup window never appears and the error message: “There was an error processing your payment. Please try again.”

Screen Shot 2022-01-19 at 10 58 23 AM Screen Shot 2022-01-18 at 1 44 27 PM

Expected Result:

Screen Shot 2022-01-28 at 2 42 14 PM



Resolution for this would be: better error message. 
“Could not connect to paypal server. Please disable pop-blockers or try a different browser.” 


Steps:

Paypal Error Docs: https://developer.paypal.com/docs/checkout/standard/customize/handle-errors/

Pomax commented 2 years ago

I can't reproduce this. No matter what amount I fill in, the paypal donate window shows up, whether in private browsing or already logged into paypal, with noscript and adblock both running.

stephanielowry commented 2 years ago

@danielfmiranda I tested this in Firefox, Safari and on my iPhone (Safari) and things are working as expected now.

Previously, the error message would appear for amounts under $10 in the browsers listed above on the main donate.mozilla.org page (no special URL). I haven't changed any settings or didn't access the page a different way either.

stephanielowry commented 2 years ago

I did get the error for the Thunderbird page using Firefox just now using this link: https://give.thunderbird.net/en-US/

Screen Shot 2022-01-31 at 8 52 40 PM
danielfmiranda commented 2 years ago

Hi everyone!

This is proving to be a difficult issue to reproduce, as I am experiencing the same thing as Pomax, attempting to reproduce this issue on any browser with/without adblock installed on the browser/incognito modes turned on/etc all seem to work for me. However, I was able to reproduce the error following these specific steps:

After repeatedly trying to donate a small amount for some time (opening and closing the paypal window), I then experience something similar to the bug that Stephanie is reporting. The error message gets displayed, the paypal window gets closed out, and a 429 Rate Limit Code is thrown in the requests response:

Screen Shot 2022-02-07 at 3 42 14 PM

I then took a look into the code to see where this error is being caught, and found it here: https://github.com/mozilla/donate-wagtail/blob/c4f543fb2e027cc390e94288a2aac5b9a03baa08/source/js/components/paypal.js#L101-L108

I then confirmed that this is where the error is being produced, by adding in some custom text in the error message function and then reproducing the bug by getting the 429 code:

Screen Shot 2022-02-07 at 3 47 06 PM

I was then hoping the error logged by the function above might be able to give us some context to work with, to do something like generate a new, more descriptive message if a user has hit their limit for the time period. However when logging the error to the console, this not quite helpful message appears:

Screen Shot 2022-02-07 at 3 49 32 PM

After taking a look here in the paypal developer documentation: https://developer.paypal.com/docs/checkout/standard/customize/handle-errors/

It appears that this error is generic by design and meant to be used with a generic error message.

To quote the docs "This error handler is a catch-all. Errors at this point are not expected to be handled beyond showing a generic error message or page."

That leads me to believe that this error might be on the braintree/paypal admin side as the error is produced when limiting the user from making small time donations, which I assume is something we implemented to counter fraud.

However after reaching out to Stephanie however to ask if this error was produced while testing the donate site repeatedly, she said she was able to reproduce it on her sons phone who does not visit the donate site regularly.

This leads me to some questions for @jzinner @Pomax when they have the time:

Thank you all for taking the time to read my comment!

Pomax commented 2 years ago

It honestly sounds like at this point it's not so much "Rate limiting" as in your case, but by @stephanielowry having ended up on a Paypal block list. (which we'll never learn through any API call) and it might be necessary to contact Paypal to find out what's going on.

danielfmiranda commented 2 years ago

Got it, thanks @Pomax!

@stephanielowry by any chance is it possible for you to reach out to paypal to find if this could be the case? Please let me know if there is anything I can assist with, thanks!

stephanielowry commented 2 years ago

I'm not on any block list, because I'm not putting my email address on the form, I'm using different browsers and sometimes it goes through. Donors are experiencing this same issue, but when I give them the URL with donorcare in it, they seem to have no trouble. The issue is the main donate.mozilla.org page and the give.thunderbird.net page. I use PayPal for all kinds of other things, and trying a few times I can get it through on the donate & tbird pages as well.

danielfmiranda commented 2 years ago

Got it @stephanielowry! Thank you for the heads up and for helping us troubleshoot as we try and find the cause for this. After meeting with @jzinner, they brought to my attention that this could be a case of rate limiting, as they forwarded me an email from braintree stating that as of Jan 6 this year, braintree did indicate that they were seeing unusual traffic from our URL and that if the rates did not return to normal that they can would enforce a rate limit.

To quote the email “Any requests that exceed this limit will receive a Too Many Requests (429, which is the same response that I am getting) and can be safely retried later.

@stephanielowry, I remember you mentioning that even trying the donate site on your sons phone would produce this bug, and after the response from braintree above, I believe the cause of this may be that the limit is network-wide instead of device specific. I also say this because I experience the same thing if I am getting the 429 response and then try again on a mobile device or on a different browser.

In terms of next steps, I think it would be helpful to update the language on the error message that gets produced, but since we are unable to distinguish the difference between a 429 error and other errors that may occur (see comment above), we would still have to keep it pretty general.

I propose something along the lines of “Error connecting to PayPal. Please donate with card or try again later”. as I think this gives a little more context then the message “There was an error processing your payment. Please try again.” especially considering this bug occurs before a payment is even made.

Tagging @Pomax to hear his thoughts as well

jencohoon commented 2 years ago

Hi @danielfmiranda, Thank you for your efforts on this one.

So what's left to close this issue is:

Unable to connect to Paypal. Please try again in a few minutes.