barte-api-sdk
v2.0.0
Published
The Barte API SDK to help and support the development processes.
Downloads
20
Readme
Barte SDK API
The Barte API SDK to help and support the development processes.
Installation:
$ npm i --save barte-api-sdk
API
This module exports a constructor function which takes an options object.
Barte(options)
Creates a new Barte
instance.
Arguments
options
- Required - A plain JavaScript object that contains the configuration options.
Options
apiKey
- Required - This is the API key required to make calls to Barte's APIs. This key can be generated through the dashboard panel (Configurações > Integração > Chaves API > Nova chave API).contentType
- Optional - The content type used in the request header via Axios. Defaultapplication/json
.size
- Optional - The default size for the pagination. Default10
.env
- Optional - If the environment is sandbox or production. Defaultsandbox
.timeout
- Optional - The request timeout. Default5000
.debug
- Optional - This parameter will display the Axios request if true and environment assandbox
. Defaultfalse
.
Return value
A Barte
instance.
Exceptions
Throws an Error
exception if the required options are missing.
Example
const Barte = require('barte-sdk-api-nodejs');
const BarteSDK = new Barte({
apiKey: "your-token",
env: "sandbox"
});
const buyers = await BarteSDK.buyer.list({
name: 'Buyer name'
});
Available resources and methods
- buyer
list([params])
get(id)
create(params)
update(id[, params])
- charge
list([params])
get(id)
cancel(id)
refund(id[, params])
- order
create(params[, headers])
list([params])
get(id)
cancel(id)
calcInstallments(params)
- card
create(params)