Events Made Easy › Forums › Bug fixed or feature request implemented › 500 Error after Stripe membership submit redirect
- This topic has 17 replies, 2 voices, and was last updated 5 years, 10 months ago by Franky.
-
AuthorPosts
-
Sat 5 Jan 2019 at 01:37 #59298AnonymousInactive
Steps to reproduce:
1. Buy a membership using Stripe in either Test or Live mode.
2. After submitting payment details, user gets redirected back to the membership page in question, but it gives a 500 for some reason. The 500 error page itself gives no other information – it’s just the standard browser 500 error page. If I renavigate to the URL in question, it will load up fresh again. But if I refresh, I get 500 error again, so the error seems to be contingent on the browser sending some data.I checked the forum and noted you asked for server error logs when 500 errors happen. I am getting an error repeatedly, although it is not totally concurrent with the 500 error itself. There are 2 similar errors. Here they are:
[Fri Jan 04 04:53:37.652747 2019] [:error] [pid 27812] [client IPADDRESSREDACTED] PHP Warning: join(): Invalid arguments passed in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/eme_events.php on line 2496 [Fri Jan 04 04:58:41.229909 2019] [:error] [pid 28118] [client IPADDRESSREDACTED] PHP Warning: join(): Invalid arguments passed in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/eme_events.php on line 2496, referer: https://fastfest.me/wp-admin/admin.php?page=eme-manager&eme_admin_action=edit_event&event_id=7&eme_admin_nonce=b42e1e7d65
Sat 5 Jan 2019 at 10:18 #59301FrankyKeymasterThat has already been fixed in the dev-version, but it shouldn’t lead to 500-errors for stripe. You need to check in your logs and first find the 500-line (typically in your error log).
Mon 7 Jan 2019 at 19:54 #59318AnonymousInactiveHi Franky, I tried again today (just Stripe Test Mode so far), and was not able to reproduce the 500 error, but I would still like to ensure that the error does not happen again.
It took some doing but I finally got my host to provide the proper error log! Please have a look and let me know if it had to do with a bug that was fixed already or something.
[Fri Jan 04 21:30:22.196679 2019] [php7:error] [pid 12665] [client {IP ADDRESS REDACTED}] PHP Fatal error: Uncaught Stripe\\Error\\InvalidRequest: Missing required param: currency. in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php:124 from API request 'req_{REDACTED}'\nStack trace:\n#0 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(102): Stripe\\ApiRequestor::_specificAPIError('{\\n "error": {\\n...', 400, Array, Array, Array)\n#1 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(309): Stripe\\ApiRequestor->handleErrorResponse('{\\n "error": {\\n...', 400, Array, Array)\n#2 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(65): Stripe\\ApiRequestor->_interpretResponse('{\\n "error": {\\n...', 400, Array)\n#3 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiResou in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php on line 124, referer: https://fastfest.me/futurefemme-membership/
Mon 7 Jan 2019 at 22:07 #59321AnonymousInactiveI am getting the error again. So perhaps there is some intermittent quality to the issue at hand.
Mon 7 Jan 2019 at 22:18 #59322FrankyKeymasterThis seems to be the problem:
Missing required param: currency
The thing is that that param is passed (the value being the currency of the membership defined). Do you have some custom currency defined for your membership or so?
I’ll test it here tooMon 7 Jan 2019 at 22:30 #59323FrankyKeymasterSee if this helps:
https://plugins.trac.wordpress.org/changeset/2008048/Mon 7 Jan 2019 at 22:54 #59327AnonymousInactiveThat did not fix the issue for me, although it appears to have done something. I am not using a special currency at all. Just selected “Pound Sterling” in the Event Price dropdown. If it is at all relevant, USD is my default currency in the general EME settings.
I don’t know how to check what value is being sent to the Stripe API, but it is obviously a problem (should surely be “gbp”), as this is the server error message I’m getting now:
PHP Fatal error: Uncaught Stripe\\Error\\InvalidRequest: Invalid currency: . Stripe currently supports these currencies: usd, aed, afn, all, amd, ang, aoa, ars, aud, awg, azn, bam, bbd, bdt, bgn, bif, bmd, bnd, bob, brl, bsd, bwp, bzd, cad, cdf, chf, clp, cny, cop, crc, cve, czk, djf, dkk, dop, dzd, egp, etb, eur, fjd, fkp, gbp, gel, gip, gmd, gnf, gtq, gyd, hkd, hnl, hrk, htg, huf, idr, ils, inr, isk, jmd, jpy, kes, kgs, khr, kmf, krw, kyd, kzt, lak, lbp, lkr, lrd, lsl, mad, mdl, mga, mkd, mmk, mnt, mop, mro, mur, mvr, mwk, mxn, myr, mzn, nad, ngn, nio, nok, npr, nzd, pab, pen, pgk, php, pkr, pln, pyg, qar, ron, rsd, rub, rwf, sar, sbd, scr, sek, sgd, shp, sll, sos, srd, std, szl, thb, tjs, top, try, ttd, twd, tzs, uah, ugx, uyu, uzs, vnd, vuv, wst, xaf, xcd, xof, xpf, yer, zar, zmw, eek, lvl, svc, vef in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php:124 from API request 'req_{REDACTED}'\nStack trace:\n#0 /nas/content/live/fastfest/wp-content/plug in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php on line 124, referer: https://fastfest.me/futurefemme-membership/
Mon 7 Jan 2019 at 23:45 #59334FrankyKeymasterArghl … the error was something totally different (although the lowercase is probably needed too).
This extra fix should help:
https://plugins.trac.wordpress.org/changeset/2008081Tue 8 Jan 2019 at 01:28 #59335AnonymousInactiveThanks for the fix. Looks like those four functions need refactoring, as they all contain exactly the same conditional. Your functions look too long to me!
It probably fixed that one bug, but there looks to be a 3rd bug lurking behind it.
Perhaps none of your users have yet sold a membership with Stripe?
Anyways, here’s the error log this time.
PHP Fatal error: Uncaught Stripe\\Error\\InvalidRequest: Invalid positive integer in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php:124 from API request 'req_REDACTED'\nStack trace:\n#0 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(102): Stripe\\ApiRequestor::_specificAPIError('{\\n "error": {\\n...', 400, Array, Array, Array)\n#1 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(309): Stripe\\ApiRequestor->handleErrorResponse('{\\n "error": {\\n...', 400, Array, Array)\n#2 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(65): Stripe\\ApiRequestor->_interpretResponse('{\\n "error": {\\n...', 400, Array)\n#3 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiResource.php(1 in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php on line 124, referer: https://fastfest.me/futurefemme-membership/
Tue 8 Jan 2019 at 08:30 #59339FrankyKeymasterNo 2 payment gateways are alike, so the resulting code needs to take all that into account.
But your error seems to indicate that the price now sent to stripe is 0 . The currency is ok, but apparently the price not. I’ll check this evening. Please check your webserver logfiles for regular php errors, because even the currency thing would have been logged as an undefined variable notice (and the fix would have been quicker)Tue 8 Jan 2019 at 18:58 #59348FrankyKeymasterI just reactivated my stripe account and did a test booking and payment: all works just fine.
Tue 8 Jan 2019 at 19:23 #59350AnonymousInactiveThe front end shows a positive amount for the purchase.
Here is the latest error. I think it’s the same as the previous one. What other data can I get you to help you troubleshoot? If we can’t figure this out I may have to throw out a few weeks of work spent getting EME to work… 🙁
PHP Fatal error: Uncaught Stripe\\Error\\InvalidRequest: Invalid positive integer in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php:124 from API request 'req_REDACTED'\nStack trace:\n#0 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(102): Stripe\\ApiRequestor::_specificAPIError('{\\n "error": {\\n...', 400, Array, Array, Array)\n#1 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(309): Stripe\\ApiRequestor->handleErrorResponse('{\\n "error": {\\n...', 400, Array, Array)\n#2 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php(65): Stripe\\ApiRequestor->_interpretResponse('{\\n "error": {\\n...', 400, Array)\n#3 /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiResource.php(1 in /nas/content/live/fastfest/wp-content/plugins/events-made-easy/payment_gateways/stripe/stripe-php-5.5.0/lib/ApiRequestor.php on line 124, referer: https://fastfest.me/futurefemme-membership/
Tue 8 Jan 2019 at 21:25 #59359FrankyKeymasterYou have to check your stripe logs (even in test there is in stripe a log for every request). But compare your version of eme_payments.php with this one:
https://plugins.trac.wordpress.org/browser/events-made-easy/trunk/eme_payments.phpAt the bottom there’s a link to download the plain text version.
And if all else fails: give me admin access to a test site of yours where you have the issue. I’ll use my test key/pwd and see what gives then.
Tue 8 Jan 2019 at 22:30 #59362AnonymousInactiveThe only deltas my diff shows between your file and mine are the updated comments I didn’t bother to copy over into mine.
Your payment error handling definitely needs work if users are getting sent to blank 500 pages when the response comes back with an error… but that is another issue.
Great idea checking the Stripe logs. I never had to do that before. Here is the result, and indeed it shows 0 for the amount. But I have no idea why that should be, as the membership is set to 30 GBP and the Stripe popup also shows 30 GBP:
Request POST body { "amount": "0", "currency": "gbp", "source": "tok_REDACTED", "receipt_email": "REDACTED", "description": "Member signup for 'REDACTED'", "metadata": { "member_id": "13", "payment_id": "37" } } Response body { "error": { "code": "parameter_invalid_integer", "doc_url": "https://stripe.com/docs/error-codes/parameter-invalid-integer", "message": "Invalid positive integer", "param": "amount", "type": "invalid_request_error" } }
Tue 8 Jan 2019 at 22:36 #59363FrankyKeymasterThe payment error handling is done by stripe. Again: every api has it’s own way of handling things, some better than others. The error ‘invalid positive integer’ is also generated by stripe, not me. That’s the only thing they provide, and so their error is what I can show.
Now back to the problem: the price being 0. I’ll test some more, I just realized I tested using an rsvp on an event, not a membership.
Edit: good news (now, well … good …): I can reproduce it, let me test more now.Tue 8 Jan 2019 at 22:57 #59364FrankyKeymasterOk, success. Reason was: in the case of a number of payment gateways the payment price was being calculated as an event price, not a member price. This change should fix it (test seems to confirm it):
https://plugins.trac.wordpress.org/changeset/2008708/Since those gateways were never before tested with memberships, nobody stumbled on this error before … Payment gateways affected were: stripe, paymill and braintree.
Tue 8 Jan 2019 at 23:17 #59365AnonymousInactiveThank you very much for sticking with me on this bug Franky. We squashed all three! I will check back in if anything else fishy comes up with Stripe.
Tue 8 Jan 2019 at 23:24 #59367FrankyKeymasterAnd thanks for insisting on the problem.
Original cause: those 3 gateways “phone” home before going to their respective endpoints, and that is local code that existed before I started implementing memberships. So I forgot to adapt the price calculation there when memberships came into existence. -
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.