#bobo00011
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- bobo00011, 26 minutes ago, 51 messages
import stripe from "./payments";
import prisma from "./db";
import bodyParser from "body-parser";
console.log(bodyParser);
const router_webhooks = Router();
/**
* Webhook Stripe payment
*/
router_webhooks.post("/payments", bodyParser.raw({type: "application/json"}), (req, res, next) => {
const payload = req.body;
const sig = req.headers["stripe-signature"];
let event = null;
console.log(payload);
try {
event = stripe.webhooks.constructEvent(payload, sig, process.env.STRIPE_WEBHOOK_SECRET);
} catch (err) {
console.log("Webhook signature verification failed.")
return res.status(400).send(`Webhook Error: ${err.message}`);```
error:
Webhook signature verification failed.
What does the complete error say?
i have to pass string or buffer
not object
but I did it as
you have in docs
and it doesnt work
What did you try? because your code is just parsing the request as json
router_webhooks.post("/payments", bodyParser.raw({type: "application/json"}), (req, res, next) => {
instead of application/json try setting */*