#louis-tam_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1245436876123275284
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
It sounds like your server's endpoint isn't receiving the webhook, which could be caused by a lot of different things.
What command are you running to create the listener?
in terminal you mean?
stripe listen --forward-to localhost:5000/webhook
Not surewhat I am doingwrong
And you're certain your route is configured properly? Can you open it in a browser and get something other than "Page not found"?
My route in express is like this stripeRoutes.post(
"localhost:5000/webhook",
bodyParser.raw({ type: "application/json" }),
(request, response) => {
console.log("recieved webhook req");
const payload = request.body;
console.log("got payload", payload);
response.status(200).end();
}
);
export default stripeRoutes;
i can't get it to console.log anything
yes, but what happens when you open localhost:5000/webhook in your browser while the server is running?
It directs to my 404 page
Hmmm, it sounds like that route might be misconfigured on your server. I'm not really sure what your code is doing to be honest. The Express routes I've seen look like this:
app.post('/webhook', async (req, res) => { "Do stuff here" res.send(); });
If i run this in index.js instead it still gives me the same result app.post(
"localhost:5000/webhook",
bodyParser.raw({ type: "application/json" }),
(request, response) => {
console.log("recieved webhook req");
const payload = request.body;
console.log("got payload", payload);
response.status(200).end();
}
);
I don't think you need to pass localhost:5000/webhook in your route. It should be just /webhook right?
yeah i did that before just like the docs said and it didnt work. another support person said to put localhost5000
wait nvm when i run it in app as wewbhook it runs fine now
Yep, that makes sense
Thanks I think i gotta reconfig my stripeRoutes