Problem with your Stripe Webhook

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.

Webhook url

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: 213.165.184.36, 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

54.187.205.235 - - [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-admin/admin-ajax.php?action=stripe_webhook. It should have been https://domain.com/?wc-api=wc_stripe  as mentioned earlier. That caused it not to work and Stripe sending us an email with “Problem with your Stripe Webhook” in the title.

Tagged in : Tagged in :
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.