#4e656f
1 messages · Page 1 of 1 (latest)
I'm confused. What's your question?
Why i don't get console.log im my route.ts
What does your listener show when you trigger an event? Can you copy/paste the output?
It gives me this:
2023-12-12 19:52:17 --> charge.succeeded [evt_3OMb3zElNHG3Wsnf0ZNXcGIv]
2023-12-12 19:52:17 <-- [307] POST http://localhost:3000/api/stripe/webhook [evt_3OMb3zElNHG3Wsnf0ZNXcGIv]
2023-12-12 19:52:17 --> payment_intent.succeeded [evt_3OMb3zElNHG3Wsnf02syonrf]
2023-12-12 19:52:17 <-- [307] POST http://localhost:3000/api/stripe/webhook [evt_3OMb3zElNHG3Wsnf02syonrf]
2023-12-12 19:52:17 --> payment_intent.created [evt_3OMb3zElNHG3Wsnf0WoHbaBM]2023-12-12 19:52:17 <-- [307] POST http://localhost:3000/api/stripe/webhook [evt_3OMb3zElNHG3Wsnf0WoHbaBM]```
when i click does link it redirect me to ```https://dashboard.stripe.com/test/events/evt_3OMasPElNHG3Wsnf1jKEmExy```
Where in your code do you define /api/stripe/webhook as your route?
im using nextjs14 with route handler https://nextjs.org/docs/app/building-your-application/routing/route-handlers
my folder is app/api/stripe/webhook/route.ts
so the route will be localhost:3000/api/stripe/webhook
tested it with postman and it worked got the console.logs
The temporary redirect HTTP 307 is a bit confusing. Have you tried listening to the https version of the endpoint? So running this instead: stripe listen --forward-to https://localhost:3000/api/stripe/webhook
i get error when i add https:
2023-12-12 20:05:53 [ERROR] Failed to POST: Post "https://localhost:3000/api/stripe/webhook": http: server gave HTTP response to HTTPS client
2023-12-12 20:05:53 --> payment_intent.succeeded [evt_3OMbHAElNHG3Wsnf0JivHE2B]
2023-12-12 20:05:53 [ERROR] Failed to POST: Post "https://localhost:3000/api/stripe/webhook": http: server gave HTTP response to HTTPS client
2023-12-12 20:05:53 --> payment_intent.created [evt_3OMbHAElNHG3Wsnf07sO1gVh]2023-12-12 20:05:53 [ERROR] Failed to POST: Post "https://localhost:3000/api/stripe/webhook": http: server gave HTTP response to HTTPS client
Hmmmm...
So the issue is that Stripe doesn't allow redirects for endpoints. I'm not sure what in your integration is causing a temporary redirect to happen, but whatever it is, you'll need to disallow redirects completely so that the webhook can directly access the endpoint
i dont got any redirect i just followed this:
https://dashboard.stripe.com/test/webhooks/create?endpoint_location=local
the only thing i change is stripe listen --forward-to localhost:4242/webhook to localhost:3000/api/stripe/webhook
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Was to lazy to code a custom checkout page that why i wanted to use the stripe nocode and listen to the event using webhook.
is there any other way to listen to stripe event other than webhooks?
No. You can view the events in the Stripe Dashboard, but you won't be notified of those for the most part