Sometimes you will get an email from Stripe telling you there is a problem with your Stripe Webhook. For some reason it fails. Either the web hook cannot be found somehow or it cannot be loaded properly.
You can find the webhook to be used in your WooCommerce settings > Checkout > Stripe . It should be something like https://domain.com/?wc-api=wc_stripe . Copy it over into your Stripe Dashboard under webhooks should work just fine out of the box. This webhook can be used to:
- Update a customer’s membership record in your database when a subscription payment succeeds
- Email a customer when a subscription payment fails
- Check out the Dashboard if you see that a dispute was filed
- Make adjustments to an invoice when it’s created (but before it’s been paid)
- Log an accounting entry when a transfer is paid
So really useful on giving feedback when payments fail. And that we had in our case. Wrote about that Stripe issue here.
Errors 404 – Webhook not found
We had the following error in our logs related to this
2018/01/24 21:56:44 [error] 16241#16241: *41904 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 18.104.22.168, server: domain, request: "POST /?wc-ajax=checkout HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm-wordpress.sock", host: "publiqly.com", referrer: "https://domain.com/checkout/"
and in the access log we found
22.214.171.124 - - [25/Jan/2018:06:29:14 +0000] "POST /wp/wp-admin/admin-ajax.php?action=stripe_webhook HTTP/1.1" 400 11 "-" "Stripe/1.0 (+https://stripe.com/docs/webhooks)" "-"
So somehow the webhook was not found and so no 2xx response was given. And as Stripe mentions this is one of the most common mistakes using webhooks. The wrong url is entered.
Issue & Solution
In our case we had entered the wrong webhook url https://domain.com/wp/wp-