Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signing
import Stripe from "stripe";
import { buffer } from "micro";
import Cors from "micro-cors";
import prisma from "../../utils/prisma";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
//const webhookSecret = OLDKEY
// Stripe requires the raw body to construct the event.
export const config = {
api: {
bodyParser: false,
},
};
const cors = Cors({
allowMethods: ["POST", "HEAD"],
});
const webhookHandler = async (req, res) => {
if (req.method === "POST") {
const buf = await buffer(req);
const signature = req.headers["stripe-signature"];
