I have this error when I run stripe listen --forward-to localhost:3000/webhook on cmd and server on hyperterminal.
[stripe listen --forward-to localhost:3000/webhook][1]
I basically copied and pasted from the document so I'm not sure what is the problem [1]: https://i.stack.imgur.com/iosZa.png [2]: https://i.stack.imgur.com/Wk0xY.png
const stripe = require("stripe")(process.env.STRIPE_PRIVATE_KEY);
const bodyParser = require("body-parser");
const app = express();
app.post('/webhook', bodyParser.raw({type: 'application/json'}), (request, response) => {
const payload = request.body;
console.log("Got payload: " + payload);
response.status(200);
});
The issue is that response.status(200) does not actually send the response. For that you need to use sendStatus(200) (docs) or follow your status(200) with a send() (see docs).
Also this previous answer, related: https://stackoverflow.com/a/38621009/12474862