#idealconceptz
1 messages · Page 1 of 1 (latest)
hi there!
so your code on localhost:3000/api2/payment/stripe/webhook is never called?
have you tried adding some logs to make sure it's the case?
yes, correct, 1st line of code is "console.log("WEBHOOK stripe post event ");
if I post from Postman, I see the log
stripe listen logs look correct, e.g.
2024-02-26 10:40:24 --> payment_intent.created [evt_3Oo1bgFt7eFMAPq10ALi9K3X]
2024-02-26 10:40:24 <-- [308] POST http://localhost:3000/api2/payment/stripe/webhook [evt_3Oo1bgFt7eFMAPq10ALi9K3X]
308 error means there's a redirect in your endpoind, and Stripe doesn't follow redirects
ah, interesting. I'm using Nextjs with middleware, so that could be affecting it
thanks soma, that's given me something to investigate
I assume in production though, the webhooks will be hit?
in both test mode and live mode you need to make sure your webhook endpoint doesn't have any redirects, or it will fail.
this is mentionned here: https://docs.stripe.com/webhooks#fix-http-status-codes
thanks
I've just removed the middleware and getting the same 308 error. Anything else you can think of that might cause this? I can't think of any other part of the code that would cause a redirect
FIXED IT!! the stripe listen url needed a trailing slash!! That's all it was. Middleware is fine!
thanks for helping me out!
Happy to help!