Skip to content

dzonatan/paysera-nodejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paysera-nodejs

Paysera payment gateway plugin for node.js

Build Status Coverage Status npm version

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: 'customer@email.com',
  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 support@paysera.com