Page MenuHomePhabricator

Error "Fatal Exception of Type "Type Error" when attempting a donation via PayPal
Closed, ResolvedPublic

Description

There have been 3 donors who have encountered the error "Fatal Exception of Type "Type Error" when attempting a donation via PayPal:

  • ZD 1686496 - CID 54993824 - ZA - when clicking on PayPal to make donation - has previously donated via PayPal

[aEA6vS73Os1fFDqwG1d1NQAAAAc] 2025-06-04 12:23:25: Fatal exception of type "TypeError"

  • ZD 1679154 - CID 6831231 - MY - This donor has attempted his donation with different browsers - on his mobile phone (iPhone) and desktop - has previously donated via PayPal

image.png (544×1 px, 144 KB)

  • ZD 1652154 - CID 41421472 - MY - reported back in March, first report of this error but we thought it was a one-off at the time - when clicking on PayPal to make donation - able to donate with PayPal after reporting

image.png (208×1 px, 77 KB)

The error may possibly be related to T388698 as it is the same donor-facing error.

Event Timeline

@EBrill-WMF @krobinson, it appears that these errors are related to the URL the donor is using to access the donation page, which is malformed. Specifically, the amount parameter is set to the value of 'null', causing some internal currency conversion logic to fail. My suspicion is that these URLs have been incorrectly generated somewhere, possibly inside an email template or perhaps occurring as part of an invalid redirect from the donate wiki.

I can see lots of examples of this problem in the logs, so I'll dig a bit deeper to see if I can find the root cause and where they are coming from.

Interesting.

They were all responding to a fundraising email when they alerted us - the first to enZAC2425_E1 ; the second to enMYC2425_E2 and the last to enMYC2425_E3 if that helps.

Could it be an email coding error?

jgleeson triaged this task as Unbreak Now! priority.

Change #1154029 had a related patch set uploaded (by Jgleeson; author: Jgleeson):

[mediawiki/extensions/DonationInterface@master] Hotfix to stop donor facing exceptions due to 'amount=null' URL param

https://gerrit.wikimedia.org/r/1154029

Change #1154029 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Hotfix to stop donor facing exceptions due to 'amount=null' URL param

https://gerrit.wikimedia.org/r/1154029

So this was for countries where we offer Paypal, but in USD instead of the local currency e.g. South Africa http://donate.wikimedia.org/?uselang=en&country=ZA. If a local currency amount is selected on donatewiki, it is passed to payments where it is automatically converted to USD. Currently we simply skip any donatewiki validation if the user selects Paypal USD, so if a user doesn't select an amount, we pass amount=null.

Thanks to Jack's patch above that doesn't break things any more e.g. https://payments.wikimedia.org/index.php/Special:GatewayChooser?currency=ZAR&country=ZA&payment_method=paypal&uselang=en&amount=null

I made an Asana task to follow up on adding some validation for this case on donatewiki. Double checked banners and they do already have amount validation for Paypal USD

XenoRyet set Final Story Points to 4.