#louis-tam_api

1 messages ¡ Page 1 of 1 (latest)

civic steepleBOT
#

👋 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.

clear thunder
#

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?

fringe moon
#

in terminal you mean?

#

stripe listen --forward-to localhost:5000/webhook

#

Not surewhat I am doingwrong

clear thunder
#

And you're certain your route is configured properly? Can you open it in a browser and get something other than "Page not found"?

fringe moon
#

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

clear thunder
#

yes, but what happens when you open localhost:5000/webhook in your browser while the server is running?

fringe moon
#

It directs to my 404 page

clear thunder
#

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(); });

fringe moon
#

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();

}
);

clear thunder
#

I don't think you need to pass localhost:5000/webhook in your route. It should be just /webhook right?

fringe moon
#

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

clear thunder
#

Yep, that makes sense

fringe moon
#

Thanks I think i gotta reconfig my stripeRoutes