thewca / worldcubeassociation.org

All of the code that runs on worldcubeassociation.org
https://www.worldcubeassociation.org/
GNU General Public License v3.0
332 stars 176 forks source link

500 Error During Stripe Payments #7363

Closed dunkOnIT closed 2 years ago

dunkOnIT commented 2 years ago

We've had multiple reports of payments through Stripe failing to load/execute effectively. See User reports quoted at the end of this Issue.

One of the more promising user reports notes a 500 error returned by the process-payment-intent file - probably good to start investigating here.

image

From a forum thread:

When I try to register to a competition, Stripe payment not working only a spinner is rotating endlessly. I have got an email from the organizer, because others have the same issue. Looking deeper into issue, I think the problem is not on Stripe side, because the WCA server returns 500 error in the background, see the screenshot from developer console:

From "Budapest ReOpen 2022 Stripe Payment Issue" email thread

We tried to use Stripe payments for Budapest ReOpen 2022, but the system crashed and failed to process even a single payment. Competitors were perfectly able to complete their WCA registrations (so the part where you pick events, add guests, etc.), but the screen kept loading forever after they added their payment information and wanted to send the registration fees.

As a competitor I have experienced similar issues during registering for Luxembourg Open 2022 a couple of months ago, so the problem doesn’t seem to be one-off case, rather a constantly occurring issue. I am quite convinced the issue happens because of the huge load of competitors trying to use Stripe in the same time (we had about 120 registrations in the first two minutes I believe). As Stripe is probably prepared to deal with 120 customers and the WCA registrations went fine as well, I suspect the connection between WCA and Stripe could be at fault. However this is only my non-programmer mind trying to find logic in the randomness, so don’t take it too seriously. Last time I faced the same issue for Luxembourg Open, it basically sorted itself out and even the organizers were surprised by my hackerman skills: I kept the page open and pressed the pay button in every five minutes until it finally went through.

So as you could see, the Stripe payment method on WCA is quite unreliable, and could crash more often I could accept as an organizer or a competitor. I’d also like to point out that many competitions set the order of the reg and waiting list based on the timestamp of the received payments, which is obviously difficult and potentially unfair if there’s an issue with Stripe. This is made even worse if you take into consideration the huge amount of people trying to register to basically every competition (at least in Europe), and know that registering just a couple of seconds late is enough to miss a competition.

gregorbg commented 2 years ago

As far as Budapest Open is concerned, this seems to be a quirk in the way Stripe handles Hungarian Forint specifically. Basically all currencies are treated as units with subunits represented in the decimals, except for Hungarian Forint which need to be multiplied with 100 then rounded up.

Cf. https://stripe.com/docs/currencies#special-cases

dunkOnIT commented 2 years ago

@gregorbg just confirmed that the screenshot is also from Budapest ReOpen 2022. So can confirm that we don't have a widespread Stripe issue.

I'm assuming this will still require a patch from our end to handle that special case, though? And if so, do we want to keep the "high priority" tag?

gregorbg commented 2 years ago

Yes, this is an actual announced competition that is having wide-spread issues and I'm already working on a patch.