I am trying to implement Paypal IPN verification in my node.js app.I am using express framework.
This is my code :
app.post('/paypal', function(req,res){
console.log("IN PAYPAL !! req.body : "+req.body);
var ipn = require('paypal-ipn');
ipn.verify(req.body, function callback(err, msg) {
if (err) {
console.log("Error:"+err);
} else {
//Do stuff with original params here
console.log("req.body.payment_status :"+req.body.payment_status+" msg: "+msg);
res.end();
if (req.body.payment_status == 'Completed') {
//Payment has been confirmed as completed
}
}
});
});
I am using paypal-ipn for this.
When I try to send the IPN message from Paypal Sandbox I am getting this message
IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again.
But when I try a sample message from terminal with the help of curl i am getting the request at my server app and it is displaying the log
IN PAYPAL !! req.body : [object Object] req.body.payment_status :Pending msg: VERIFIED POST /paypal 200 572ms