Am using the forum in Paypal tutorial to test the IPN listener, when i click on submit a new tab is opened and it says:
Error: Cannot find module 'paypal-ipn' at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17) at Object.Npm.require (/Users/mazinalmaskari/Desktop/code/.meteor/local/build/programs/server/boot.js:150:18)
at Object.Meteor.npmRequire (packages/npm-container/index.js:2:1) at [object Object].route.action (server/routing.js:6:30) at boundNext (packages/iron_middleware-stack/lib/middleware_stack.js:251:1) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)
Am not sure where the problem is exactly, I get 500 Internal Server Error
in the ngrok when i click submit.
this is my IPN listener located in the server
Router.map(function () {
this.route('ipn', {
path: '/ipn',
where: 'server',
action: function() {
var ipn = Meteor.npmRequire("paypal-ipn");
var wrappedVerify = Async.wrap(ipn, "verify");
var request = this.request;
var verified;
if (request.method !== 'POST') {
this.next();
} else {
try {
verified = wrappedVerify(request.body, {"allow_sandbox" : true});
} catch (error) {
//do something with error
}
if (verified === "VERIFIED") {
var payment = request.body;
//do something with payment
Router.go('/upload');
}
this.next();
}
}
});
});
This is the form am using (from Paypal tutorial):
<form target="_new" method="post" action="https://ba13954b.ngrok.io/ipn">
<input type="hidden" name="SomePayPalVar" value="SomeValue1"/>
<input type="hidden" name="SomeOtherPPVar" value="SomeValue2"/>
<input type="submit"/>
Any idea what might be causing this problem?
Review the module as the error message indicate. But... Try like this:
Based on: https://github.com/meteorhacks/npm