paysera-nodejs
v1.0.2
Published
Paysera payment gateway plugin for node.js
Downloads
219
Readme
paysera-nodejs
Paysera payment gateway plugin for node.js
Usage
Install this package as a npm dependency:
npm install paysera-nodejs --save
Redirecting to paysera gateway
First, require this package in your script:
var Paysera = require('paysera-nodejs');
Then, Initialize Paysera module with default parameters:
var options = {
projectid: 'X',
sign_password: 'Y',
accepturl: 'http://myaccept.url',
cancelurl: 'http://mycancel.url',
callbackurl: 'http://mycallback.url',
test: 0,
...
};
var paysera = new Paysera(options);
Finally, build and redirect to url with these available parameters:
var params = {
orderid: 123,
p_email: '[email protected]',
amount: 100,
currency: 'EUR',
...
};
var urlToGo = paysera.buildRequestUrl(params);
// Redirect to urlToGo...
Accepting callback from paysera
Check if callback from paysera is valid:
var request = { data: ..., ss1: ... }; // the request data you got from paysera callback
var isValid = paysera.checkCallback(request);
if (isValid) {
// Since callback seems valid decode callback data
var order = paysera.decode(request.data);
// Your code ... to update order status
// Don't forget to return "OK" as the response.
}
All available parameters from callback are specified in paysera specification
Contacts
If any problems occur please feel free to contact [email protected]