1.2.8 • Published 7 months ago

inter-js v1.2.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

About

Inter JS is a library to help you to interact with Inter API

Install

npm install --save inter-js

Usage

const sdk = require('inter-js')

const credentials = {
  client_id: 'client_id',
  client_secret: 'client_secret',
  scopes: [CredentialScope.COB_READ],
  certificate: {
    certificate: fs.readFileSync(path.resolve(__dirname, 'certificate.crt'), 'utf8'),
    key: fs.readFileSync(path.resolve(__dirname, 'certificate.key'), 'utf8')
  }
}
const production = false;

const InterApi = await sdk.init(credentials, production)

Example

API

create Cobrança

  const cobranca = {
    seuNumero: '123',
    valorNominal: 2.5,
    dataVencimento: new Date(),
    numDiasAgenda: 0,
    pagador: {
      cpfCnpj: '12345678909',
      nome: 'Nome da Pessoa',
      ddd: '11',
      telefone: '123456789',
      cep: '12345678',
      endereco: 'Rua 1',
      numero: '123',
      complemento: '',
      bairro: 'Bairro',
      cidade: 'São Paulo',
      uf: 'SP',
      tipoPessoa: 'FISICA'
    }
  }

  const response = await InterApi.cobranca.create(cobranca);

  console.log(response)

  // Output { codigoSolicitacao: '123' }

get Cobrança

  const codigoSolicitacao = '123'; 

  const response = await InterApi.cobranca.getCobranca(codigoSolicitacao);

update/create webhook

  const webhook = {
    webhookUrl: 'https://example.com'
  }

  const response = await InterApi.cobranca.updateWebhook(webhook);

  console.log(response)
  // Output { webhookUrl: 'https://example.com'}

Contributing

Please consult CONTRIBUTING for guidelines on contributing to this project.

Author

inter-js © Marcos Porto, Released under the Apache-2.0 License.

1.1.0

7 months ago

1.2.8

7 months ago

1.2.7

7 months ago

1.2.6

7 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.0.2

1 year ago