Hmac validation failure

I was creating the simple webhook for “order payment”, where I’m receiving the order data correctly but the issue is that I’m continuously getting HMAC VALIDATION FAILED. I have checked all the basic things specially SHOPIFY_API_SECRET.

app.post(
“/webhooks/orders”,
express.raw({ type: “application/json” }),
handleOrderWebhook
);
import crypto from “crypto”;

const SHOPIFY_API_SECRET = process.env.SHOPIFY_API_SECRET;

export const handleOrderWebhook = (req, res) => {
const rawBody = req.body;
const hmacHeader = req.get(“x-shopify-hmac-sha256”)?.trim();

if (!hmacHeader) {
console.log(“Missing HMAC header”);
return res.status(400).send(“Missing HMAC header”);
}

if (!Buffer.isBuffer(rawBody)) {
console.log(“req.body is not a Buffer”);
return res.status(500).send(“Invalid body format”);
}