A nodejs module for integration of your backend with the payment services provided by Gerencianet.
$ npm install gn-api-sdk-node
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 [email protected]:franciscotfmc/gn-api-sdk-node.git
$ cd gn-api-sdk-node/docs/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
- Creating charges with shippings
- Creating charges associated to customers
- Creating charges with marketplace
- Sending charges via post office service
- Associating customers to charges subsequently
- Subscriptions
- Detailing charges and subscriptions
- Creating and retrieving carnets
- Listing installments in advance
- Paying a charge
- Notifications
- All in one