• Resolved João Faria


    The webhook started failing and Stripe disabled it. I checked the webhook URl by accessing it directly in the browser and I get this error: Uncaught Error: Call to private WC_Stripe::__construct() from context ‘WC_Payment_Gateways’ in /path/to/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php on line 94

    I see WC_Stripe is a singleton, not sure if it has always been one or not, but the actual payment gateway classes that Stripe adds to the woocommerce list by filtering are not singleton, so I am not sure why this class is instantiated here anyway.

    Has someone seen the same issue? Anyone has a fix?

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Support Elvira K. a11n


    Hi there @jffaria,

    > The webhook started failing and Stripe disabled it.

    I’m sorry to hear that! Can you please advise if you see any particular errors in your Stripe dashboard > Developers > Webhooks > click on your webhook?

    Also, if you click the Send Test Webhook button in the upper-right corner of the same page and test it with charge.succeeded webhook, what do you get?

    Link to image: https://cld.wthms.co/vDUuW5

    Additionally, could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status.
    Select “Get system report” and then “Copy for support”.  Once you’ve done that, please use https://pastebin.com/ to paste it here.


    Thread Starter João Faria


    Hi @treibalen, thanks for the quick follow up!

    Here is the system status pastebin: https://pastebin.com/mMda6C9p

    Looking at te Stripe dashboar webhook data I see 100% failures. I did’t find the button to send a test webhook, but here is a live one for charge.succeeded: https://pastebin.com/A9cidFYW


    Plugin Support Elvira K. a11n


    Hi there @jffaria,

    Thanks for getting back to us! This is the error I saw in the webhook log:

    HTTP status code
    500 (Internal Server Error)

    Internal Server Errors(500 Errors) are obfuscated for security reasons, so you’ll want to review your server error logs to see what the exact error is and which script is causing the error. This will give you more information about the nature of the error; often, it is a specific plugin or function creating a PHP error.

    From the experience, the issue is typically coming for a theme/plugin conflict or server misconfiguration.

    Can you please advise if the same happens when you disable other plugins and switch your theme to Storefront? You may want to create a staging site for this test not to affect your live site.

    Let me know how that goes!

    Thread Starter João Faria


    Hello @treibalen, thanks for following up. I specifically wrote the error in my first post. Also it is available in the hook log as I enabled errors in my PHP settings. This is from the pastebin:

    <br><b>Uncaught Error</b>: Call to private WC_Stripe::__construct() from context ‘WC_Payment_Gateways’ in <b>/################/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php</b> on line <b>94</b><br>

    • init()<br><span class=”qm-info qm-supplemental”>wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php:70</span>
    • __construct()<br><span class=”qm-info qm-supplemental”>wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php:43</span>
    • instance()<br><span class=”qm-info qm-supplemental”>wp-content/plugins/woocommerce/includes/class-woocommerce.php:817</span>
    • payment_gateways()<br><span class=”qm-info qm-supplemental”>wp-content/plugins/woocommerce/includes/class-wc-api.php:139</span>
    • handle_api_requests()<br><span class=”qm-info qm-supplemental”>wp-includes/class-wp-hook.php:286</span>
    • apply_filters()<br><span class=”qm-info qm-supplemental”>wp-includes/class-wp-hook.php:310</span>
    • do_action()<br><span class=”qm-info qm-supplemental”>wp-includes/plugin.php:531</span>
    • do_action_ref_array()<br><span class=”qm-info qm-supplemental”>wp-includes/class-wp.php:387</span>
    • parse_request()<br><span class=”qm-info qm-supplemental”>wp-includes/class-wp.php:737</span>
    • main()<br><span class=”qm-info qm-supplemental”>wp-includes/functions.php:1105</span>
    • wp()<br><span class=”qm-info qm-supplemental”>wp-blog-header.php:16</span>
    • require()<br><span class=”qm-info qm-supplemental”>index.php:17</span>

    Does it give any hints?

    Thread Starter João Faria


    I mean, as I mentioned in the first post, the error is calling the constructor of a Singleton when getting the list of payment gateways in the webhook endpoint, but I don’t know why it would do that — i don’t see any errors in the checkout for instance, and looking in the code for the stripe plugin it adds another class in the payment gateway list, which is not a Singleton.

    Plugin Support Michael


    Automattic Happiness Engineer


    Thanks for the additional information. As you mentioned the Stripe plugin uses a different class for this, so it’s not something we would expect to be happening. Or can reproduce on any of our test sites.

    If we look at the location where it’s calling the new constructor it points to this part of WooCommerce: https://github.com/woocommerce/woocommerce/blob/3.7.1/includes/class-wc-payment-gateways.php#L85-L95

    That means that if the class WC_Stripe is being passed to that list then it needs to be hooked into the filter woocommerce_payment_gateways

    In the Stripe code we see very different classes being added to that list: https://github.com/woocommerce/woocommerce-gateway-stripe/blob/4.2.5/woocommerce-gateway-stripe.php#L207-L226

    So that would lead us to believe that there is some other code somewhere which hooks into woocommerce_payment_gateways
    A conflict test would be helpful in that case, to rule out where the code might be coming from.

    Or as an alternative you could use a plugin to search for specific code:

    Can you use that to search for either woocommerce_payment_gateways or WC_Stripe to see if you find any other locations where that might be altered?

    Plugin Support Elvira K. a11n


    Hi there @jffaria,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Hi team

    I’m having a similar problem. Any help? Suggestions?

    Fatal error: Uncaught Error: Call to private WC_Stripe::__construct() from context ‘WC_Payment_Gateways’ in /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php:94 Stack trace: #0 /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(70): WC_Payment_Gateways->init() #1 /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(43): WC_Payment_Gateways->__construct() #2 /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-woocommerce.php(826): WC_Payment_Gateways::instance() #3 /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-wc-api.php(139): WooCommerce->payment_gateways() #4 /home/psico613/public_html/escola/wp-includes/class-wp-hook.php(288): WC_API->handle_api_requests(Object(WP)) #5 /home/psico613/public_html/escola/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array) #6 /home/psico613/public_html/e in /home/psico613/public_html/escola/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php on line 94

    Thank you!

    HI @mikkamp @treibalen

    I got the same problem.

    WooCommerce Stripe Gateway Versión 4.5.2
    WooCommerce Version Versión 4.5.1
    WordPress 5.5.1

    the pluggin says that I have to have the following events fired in stripe’s webhook.
    Stripe is giving me communication errors in all of them.
    I activate as the pluggin says the following:

    Example of error:
    charge.succeeded => 500 (Internal Server Error)

    How can i resolve it?

    Thanks in advanced

    Same im getting this error when accesing the ?wc-api=wc_stripe hook:

    2020-09-03T03:16:45+00:00 CRITICAL Uncaught Error: Call to private WC_Stripe::__construct() from context 'WC_Payment_Gateways' in /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php:94
    Stack trace:
    #0 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(70): WC_Payment_Gateways->init()
    #1 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(43): WC_Payment_Gateways->__construct()
    #2 /var/www/html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(838): WC_Payment_Gateways::instance()
    #3 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-api.php(139): WooCommerce->payment_gateways()
    #4 /var/www/html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
    #5 /var/www/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #6 /var/www/html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
    #7 /var/www/html/wp-includes/class-wp.php(388): do_action_ref_array('parse_request', Array)
    #8 /var en /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php en la línea 94
    Thread Starter João Faria


    @matiasmarchetti @fhweb2019 @adriangzz

    I have tried looking a bit for what may have caused this but didn’t find anything. Pretty annoying though. Do you guys want to try to join forces and we can try to solve this?

    Stripe sent me a message after 19days of errors that they cut off the webhook because the errors.

    Thread Starter João Faria


    @matiasmarchetti yes, they do that to avoid expending resources on that busy load that doesn’t accomplish anything.

    It is still strange because the payments come in, everything is fine but the webhook reports an error 500 to stripe.

    Thread Starter João Faria


    @matiasmarchetti yes, the webhook is only to notify WooCommerce of things that happened, but it doesn’t affect credit card payments because they are synchronous anyway. The issue would be for async payments or, for example, if you get a chargeback on a card payment, WooCommerce only knows of the chargeback because of the webhook (and is supposed to add a note to the order, and set the order to pending or something like that).

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Stripe webhook failing’ is closed to new replies.