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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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 97

    Peter Coburn
    #18138

    Hi 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 Harris
    #18182

    Actually 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 Coburn
    #18184

    Hi 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 Harris
    #18185

    I’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 Harris
    #18188

    I 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
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.