Im trying to integrate 2Checkout on application that the front-end is build on Angular 11 and back end Node js, i managed to integrate IPN(Instant Payment Notification) of 2Checkout but i get a notification that says: ""
Our system detected that you have slow responding web hooks.
after checking documentation multiple times i saw that i need to return <EPAYMENT>20050303123434|7bf97ed39681027d0c45aa45e3ea98f0</EPAYMENT>
but still i get same response on dashboard and 2Checkout cannot verif
my code:
const bodyParse = parse(req.body);
let date = new Date();
let updatedDate =
date.getFullYear().toString() +
pad2(date.getMonth() + 1) +
pad2(date.getDate()) +
pad2(date.getHours()) +
pad2(date.getMinutes()) +
pad2(date.getSeconds());
let hashToReturn = hmac(
`${bodyParse['IPN_PID[]'].length}${bodyParse['IPN_PID[]']}${bodyParse['IPN_PNAME[]'].length}${bodyParse['IPN_PNAME']}${bodyParse['IPN_DATE'].length}${bodyParse['IPN_DATE']}${updatedDate.length}${updatedDate}`
);
console.log('hashToReturn', hashToReturn);
res.send(`Verified OK! <EPAYMENT>${updatedDate}|${hashToReturn}</>`)
function hmac(stringToHash: string) {
const secretKey = process.env.checkoutSecret;
const hmac = crypto.createHmac('MD5', secretKey);
return hmac.update(stringToHash).digest('hex');
}
I cant figure it out what I'm missing or what is wrong i tried to contact 2Checkout support but they just replied with code samples from PHP and parts from documentation.