const ipn = require('paypal-ipn);
module.exports = {
yourIPNfunction: function(options) {
//options contains the input data you use in the UI for this SC action. You will probably pass the params that the IPN verify function needs via a binding in the UI.
ipn.verify(params, function callback(err, msg) {
if (err) {
console.error(err);
} else {
// Do stuff with original params here
if (params.payment_status == 'Completed') {
// Payment has been confirmed as completed, return something
return true
}
else {
return false
}
}
});
}
}
In the hsjon file the action key needs to have the value yourIPNfunction
Thanks a lot for the code tidy up @JonL , much appreciated. You are a great help to this community. Unfortunately the “require” issue remained HOWEVER also thanks to @Pier, your solution worked perfectly i.e. installing npm via docker container. Starting to wonder is all it may have needed was a simple deploy to local target?, i can remember if i did or not
If you are using a local server an npm install in the project folder and a require should be more than enough. Installing the module in a docker container shouldn’t make a difference at all given that you are not using docker to develop your app.
Yes, me! Thought my testbed was set up to use inbuild node server (that’s my normal setup) but for some strange reason i had set this one up in docker local.
Only when I saw Pier’s post did I check and realise what i had done
My Bad