#Stripe webhook errors & disabled

22 messages · Page 1 of 1 (latest)

fading bramble
#

I'm in the final stages of finishing my membership system built with Laravel Spark, version "laravel/spark-stripe": "^2.6.4",. It is hosted on Forge through a Digital Ocean droplet.

I get the following error email from Stripe:

We’ve had some trouble sending requests in live mode to a webhook endpoint associated with your MySite account for nine consecutive days. (...)
The URL of the failing webhook endpoint is: https://www.mysite.no/spark/webhook
(...)
41 requests returned a HTTP 301, indicating your server is redirecting Stripe to deliver the event to a new location. This usually signifies you should update your webhook endpoint’s URL. You need to return any status code between HTTP 200 to 299 for Stripe to consider the webhook event successfully delivered.

The request has failed so many times that the webhook endpoint has been disabled by Stripe.

I've gone through the Spark documentation again and made sure the environment is set up correctly, I've registered the correct API keys and webhook endpoints, and I can't find any errors or typos anywhere.

Does anyone know why this is happening? I'd be happy to share any error logs or screenshots, if necessary.

gaunt heron
#

So if you call that URL manually, you don't get a 301?

#

It could for instance be a redirect from https to https, or from www. to without www.

fading bramble
#

Both with and without www, I get this error:

Oops! An Error Occurred
The server returned a "405 Method Not Allowed".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
gaunt heron
#

Are you calling with the right method (I'm guessing POST)?

#

You want to make the same call Stripe does, and see why you get a 301

fading bramble
#

I don't know. I have no idea how to do that. I've installed Spark, followed the documentation (at least I am quite sure), and the webhooks doesn't work. That's really all I know.

gaunt heron
#

405 means you're calling with the wrong method. If you run php artisan route:list, what method is the /spark/webhook registered for? That's the one you want to use

fading bramble
gaunt heron
#

Yes, so if you send the same POST using something like Insomnia or Curl, you can perhaps see why you get a 301 response

fading bramble
#

Not sure if I'm doing this right, but sending a POST-request to mysite.no/spark/webhook with Postman gives me a 403 error.

austere bison
fading bramble
#

That makes sense.

#

Some additional info: It appears as payments go through sometimes, even today, even though the webhook has been disabled.

austere bison
#

Well yes, Stripe will continue to process payments. But you’re just not going to get any webhooks sent to your server for your application to process any events.

#

The Stripe dashboard will show responses for webhook attempts.

#

I think there’s even a button or option to re-try a failed webhook. So you could ad logging around your handler, try re-sending a webhook, and look at your logs.

fading bramble
#

Resent now. It throws a 500 error. Tried resending another. Succeeded 200.

#

Should I just try to resend every one of them? The only real change I've done is remove 'www' in the webhook url.

austere bison
#

Well, no. You should open your error logs and see why Stripe got a 500 error.

#

That means your application threw an exception.