This package has been deprecated

Author message:

Este pacote será descontinuado. Use o 'sdk-node-apis-efi' no lugar.

sdk-typescript-apis-efi
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

SDK Node.js para APIs Efí Pay

Banner APIs Efí Pay

Um módulo nodejs para integrar seu backend com os serviços de pagamento da Efí.

Instalação

$ npm install sdk-typescript-apis-efi

Uso Básico

Importe o módulo:

import EfiPay from 'sdk-typescript-apis-efi';

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

export default {
	// PRODUÇÃO = false
	// HOMOLOGAÇÃO = true
	sandbox: false,
	client_id: 'seuClientId',
	client_secret: 'seuClientSecret',
	certificate: 'caminho/Ate/O/Certificado/Pix',
	cert_base64: false, // Indica se o certificado está em base64 ou não
};

Instancie o módulo passando as options:

const efipay = new EfiPay(options);

Crie uma cobrança:

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

efipay
	.createCharge({}, chargeInput)
	.then((resposta) => {
		console.log(resposta);
	})
	.catch((error) => {
		console.log(error);
	});

Exemplos

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

$ git clone git@github.com:efipay/sdk-typescript-apis-efi.git
$ cd sdk-typescript-apis-efi/examples
$ npm install

Defina suas credenciais em credentials.js:

export default {
	// PRODUÇÃO = false
	// HOMOLOGAÇÃO = true
	sandbox: false,
	client_id: 'seuClientId',
	client_secret: 'seuClientSecret',
	certificate: 'caminhoAteOCertificadoPix',
	cert_base64: false, // Indica se o certificado está em base64 ou não
};

Em seguida, execute o exemplo que você deseja:

$ npx tsx createCharge.ts

Documentação

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

License

MIT

Package Sidebar

Install

npm i sdk-typescript-apis-efi

Weekly Downloads

356

Version

1.2.0

License

MIT

Unpacked Size

802 kB

Total Files

159

Last publish

Collaborators

  • jvoliveiragn
  • joao-muniz-efi