Socket
Socket
Sign inDemoInstall

gn-api-sdk-typescript

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gn-api-sdk-typescript

Module for integration with Gerencianet API"


Version published
Weekly downloads
2.1K
decreased by-0.53%
Maintainers
1
Weekly downloads
 
Created
Source

gn-api-sdk-typescript

A Typescript module for integration of your backend with the payment services provided by Gerencianet.

Um módulo Typescript para integrar seu backend com os serviços de pagamento da Gerencianet.

Instalação

$ npm install gn-api-sdk-typescript

Uso Básico

Importe o módulo:

import Gerencianet from 'gn-api-sdk-typescript';

Insira suas credenciais e defina se deseja usar o sandbox ou não. Você também pode usar o arquivo examples/config.ts de modelo.

export = {
	// PRODUÇÃO = false
	// HOMOLOGAÇÃO = true
	sandbox: false,
	client_id: 'seuclient_id',
	client_secret: 'seuclient_secret',
	certificate: 'caminhoAteOCertificadoPix',
};

Instancie o módulo passando as options:

const gerencianet = Gerencianet(options);

Crie uma cobrança:

var body = {
	items: [
		{
			name: 'Product A',
			value: 1000,
			amount: 2,
		},
	],
};

gerencianet
	.createCharge({}, body)
	.then((resposta: any) => {
		console.log(resposta);
	})
	.catch((error: Promise<any>) => {
		console.log(error);
	})
	.done();

Exemplos

Para executar os exemplos, clone este repo e instale as dependências:

$ git clone git@github.com:gerencianet/gn-api-sdk-typescript.git
$ cd gn-api-sdk-typescript/examples
$ npm install

Defina suas credenciais em config.ts:

export = {
	// PRODUÇÃO = false
	// HOMOLOGAÇÃO = true
	sandbox: false,
	client_id: 'seuclient_id',
	client_secret: 'seuclient_secret',
	certificate: 'caminhoAteOCertificadoPix',
};

Em seguida, execute o exemplo que você deseja:

$ ts-node createCharge.ts

Documentação

A documentação completa com todos os endpoints disponíveis você encontra em: https://dev.gerencianet.com.br/.

License

MIT

Keywords

FAQs

Package last updated on 02 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc