I am trying to create a receiver for the ipn of mercadopago, saying this, I receive an error that marks me:
Unhandled rejection Error: Invalid Topic (undefined). The topics available are: preapproval, authorized_payment, payment, merchant_order
the code that I have mounted is the following
var par_payment = req.params.type;
var mercadopago = require('mercadopago');
mercadopago.configure({
sandbox: true,
access_token: 'TEST-TOKEN-GOES-HERE'
});
console.log("++++++++++parameters parse +++++++++++");
console.log (' par_payment: ' || par_payment);
console.log(req.query);
console.log( req.query['data.id']);
console.log("++++++++++++++++++++++++++++++++++++++");
mercadopago.ipn.manage(req).then(function (response) {
console.log(response);
}).then(function (error) {
console.log(error);
});
res.end();
});
and the error it gives me is the one mentioned:
Unhandled rejection Error: Invalid Topic (undefined). The topics available are: preapproval, authorized_payment, payment, merchant_order
Has any of you had this error and has a workaround?