A nodejs module for integration of your backend with the payment services provided by Gerencianet.
$ npm install gn-api-sdk-node
node 4.4.0 and 4.4.4
Require the module:
var Gerencianet = require('gn-api-sdk-node');
Set your credentials and whether you want to use sandbox or not:
var options = {
client_id: 'your_client_id',
client_secret: 'your_client_secret',
sandbox: true
}
Instantiate the module passing your options:
var gerencianet = new Gerencianet(options);
Create a charge:
var chargeInput = {
items: [{
name: 'Product A',
value: 1000,
amount: 2
}]
}
gerencianet
.createCharge({}, chargeInput)
.then(console.log)
.catch(console.log)
.done();
To run the examples, clone this repo and install the dependencies:
$ git clone git@github.com:gerencianet/gn-api-sdk-node.git
$ cd gn-api-sdk-node/examples
$ npm install
Set your oauth keys in credentials.js:
module.exports = {
client_id: 'your_client_id',
client_secret: 'your_client_secret'
}
Then run the example you want:
$ node createCharge.js
To run the test suite, first install the dependencies, then run npm test
:
$ cd gn-api-sdk-node/
$ npm install
$ npm test
The full documentation with all available endpoints is in https://dev.gerencianet.com.br/.