我在NodeJS中使用快递实现Paypal IPN,但是我从Paypal Sandbox收到此错误消息:
<html> <head><title>502 Bad Gateway</title></head> <body bgcolor="white"> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx/1.6.0</center> </body> </html>
我使用了paypal-ipn依赖项,下面是我的代码:
.post('/paypal_ipn', function(req, res) {
var params = req.body;
var ip = req.ip;
console.log(params);
res.status(200);
ipn.verify(params, {'allow_sandbox': true}, function callback(err, mes) {
if (err) {
console.error(err);
} else {
// Do stuff with original params here
if (params.payment_status === 'Completed') {
// Payment has been confirmed as completed
}
}
});
})
我尝试在端口3000上配置http和https,但收到了相同的错误消息。
有关于此的任何想法吗?