所以这是我的问题,我使用 Express JS,我正在使用 coinPayments 设置付款,一切正常 npm coinpayments,但是我无法使用 IPN 获得任何主体
router.post(
`/notify`,
(req, res, next) => {
res.send('ok');
console.log('------------------------------ipn--------------------------------------');
console.log('body', req.body);
console.log('------------------------------ipn--------------------------------------');
if (
!req.get(`HMAC`) ||
!req.body.ipn_mode ||
req.body.ipn_mode !== `hmac` ||
MERCHANT_ID !== req.body.merchant
) {
return next(new Error(`Invalid request`));
}
let isValid;
let error;
try {
isValid = verify(req.get(`HMAC`), IPN_SECRET, req.body);
} catch (e) {
error = e;
}
if (error && error) {
return next(error);
}
if (!isValid) {
return next(new Error(`Hmac calculation does not match`));
}
return next();
}
我总是得到一个空的 req.body
------------------------------ipn--------------------------------------
body {}
------------------------------ipn--------------------------------------
Invalid request at router.post.txn_id.txn_id
有谁知道为什么,我该如何解决?