EO conflicts with WP Simple Pro for Stripe plugin
WordPress Event Management, Calendars & Registration › Forums › Report A Bug › EO conflicts with WP Simple Pro for Stripe plugin
This topic contains 5 replies, has 2 voices, and was last updated by Peter Coburn 9 years, 3 months ago.
-
AuthorPosts
-
July 29, 2015 at 6:24 am #18137
We are using “WP Simple Pay Pro for Stripe” as the primary payment method on all our donation products (so we can’t get rid of it)
On our Sandbox, the Event Organiser transaction conflicts when payment is attempted via Stripe.
See https://empart-donate.com/events/event/master-class-2015-with-jossy-chacko/
(Stripe is in Test mode)
We get this error:
Fatal error: Uncaught exception ‘Stripe\Error\InvalidRequest’ with message ‘Missing required param: currency.’ in /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiRequestor.php:97 Stack trace: #0 /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiRequestor.php(209): Stripe\ApiRequestor->handleApiError(‘{\n “error”: {\n…’, 400, Array) #1 /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiRequestor.php(60): Stripe\ApiRequestor->_interpretResponse(‘{\n “error”: {\n…’, 400) #2 /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiResource.php(105): Stripe\ApiRequestor->request(‘post’, ‘/v1/charges’, Array, Array) #3 /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiResource.php(137): Stripe\ in /home/content/p3pnexwpnas07_data03/10/2680310/html/wp-content/plugins/stripe-checkout-pro/libraries/stripe-php/lib/ApiRequestor.php on line 97Peter CoburnJuly 29, 2015 at 8:53 am #18138Hi Peter,
This is a bug with the Simple Stripe plugin (please see https://wordpress.org/support/topic/do-not-use-when-you-use-stripejs-in-your-own-code). In effect the plugin is trying to process the payment for the booking.
I recall another customer had this issue but that the fix was fairly trivial. I’ll look into a patch for you and I’ll follow up with the developer on that thread.
Stephen HarrisJuly 30, 2015 at 11:49 pm #18182Actually Stephen, it is not a bug with the “WP Simple Pay Pro for Stripe” (previously Strip Checkout Pro) but with “Wp Event Organiser”.
The link you sent me to, https://wordpress.org/support/topic/do-not-use-when-you-use-stripejs-in-your-own-code was not resolved. It was closed due to no response and was not a solution.
However, the developers of “WP Simple Pay Pro for Stripe” advised that Stripe Conflict when running multiple plugins does occurs at times and to date, have always found this to be due to the way that other developers are coding their plugins.
“WP Simple Pay Pro for Stripe” plugin already does a check to see if the Stripe library already exist and skips including the Stripe PHP library if it’s already loaded. Here’s the code snippet used in “WP Simple Pay Pro for Stripe”: https://gist.github.com/pderksen/0d8184fffd04dabca1cc
It is assumed that “WP Simple Pay Pro for Stripe” is getting loaded before our custom code or other plugins that use the Stripe library, and this same check isn’t being made, so it’s throwing an error at that point.
Therefore, the devs of other plugins need to do a similar check as “WP Simple Pay Pro for Stripe” does in the above code snippet.
Are you able to do incorporate this checking into Event Organiser?
Peter CoburnJuly 31, 2015 at 12:38 am #18184Hi Peter,
You’re right in so far as Event Organiser doesn’t check if
Stripe
is already defined before loading it – and it perhaps should – however, that is not the the bug here.The error is not that Stripe is being declared multiple times, it’s that WP Simple Pay Pro for Stripe is making an invalid API request (see the above stack trace you provided). It’s making an invalid API request because it shouldn’t be making an API request at all, and has insufficient data to do so.
It’s doing that here: https://github.com/wp-plugins/stripe/blob/af80f1f200513a1a98f0e42993ee68fbbb10a6ff/classes/class-stripe-checkout-functions.php#L28
as you can see it simply checks if
$_POST['stripeToken']
token is set, and if so tries to charge the card. There is no checking to verify that the origin of that data was the plug-in, and not (as it is in this case) another plug-in.The above link to the forum thread was not intended as a solution, but to give you some context of the bug in that plug-in. I’m going to follow up with a patch for that plug-in.
Stephen HarrisJuly 31, 2015 at 1:09 am #18185I’ve started a thread here: https://wordpress.org/support/topic/conflicts-with-other-plug-ins-using-stripejs?replies=1#post-7243614 regarding this issue.
Regarding a patch, you can change
// We only want to run the charge if the Token is set if ( isset( $_POST['stripeToken'] ) ) { self::$token = true; add_action( 'init', array( $this, 'charge_card' ) ); }
to
// We only want to run the charge if the Token is set if ( isset( $_POST['sc-currency'] ) && isset( $_POST['stripeToken'] ) ) { self::$token = true; add_action( 'init', array( $this, 'charge_card' ) ); }
There’ll be an update to Event Organiser Stripe, so that it doesn’t try to load Stripe if it’s already defined, but that has no bearing on the bug described here. (In this case WP Simple Pay Pro for Stripe is using a namespaced version of the Stripe library so there won’t be any ‘multiple declaration’ issues.)
Stephen HarrisJuly 31, 2015 at 5:15 am #18188I have passed the info you have graciously provided over to the folks at WP Simple Pay Pro for Stripe.
Thank you for the excellent support Stephen and for going the ‘extra mile’… it is greatly appreciated!
Peter Coburn -
AuthorPosts