3
我想在我的node.js應用中實現PayPal IPN驗證。我使用快速框架。PayPal與node.js的IPN驗證 - 快速應用
這是我的代碼:
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
}
}
});
});
我使用paypal-ipn這一點。
當我試圖從貝寶沙箱發送IPN消息我得到這個消息
IPN傳遞失敗。無法連接到指定的網址。請驗證網址並重試。
但是當我嘗試採樣消息從終端的捲曲我在我的服務器應用程序獲取請求的幫助下,它會顯示日誌
貝寶! req.body:[對象的對象] req.body.payment_status:待定MSG:VERIFIED POST /貝寶200 572ms
從PayPal沙盒我使用的URL爲http:// myserverurl:PORTNO /貝寶 – Damodaran