gerencia_net_plus 0.0.4 copy "gerencia_net_plus: ^0.0.4" to clipboard
gerencia_net_plus: ^0.0.4 copied to clipboard

A Dart plugin that allows a better way to connect to Gerencianet - Efí Api.

gerencia_net_plus #

A Dart plugin that allows a better way to connect to Gerencianet - Efí Api.

Go to:

Features #

  • Create, update and list your Pix Charges, with or without additional expiration fees.
  • List Pix transactions.
  • Create a QRCode, Pix copy and paste, and a link to view the QRCode.

TODO:

  • Webhook functionality

Getting started #

Add gerencia_net_plus as a dependency in your pubspec.yaml file.

How to obtain Client-Id and Client-Secret credentials #

Create a new application to use the Gerencianet API

  1. Access the Gerencianet dashboard and navigate to the API section.
  2. On the left side, click on My Applications (Minhas Aplicações) and then New Application (Nova Aplicação).
  3. Enter a name for the application, enable the Payments API (Boletos e Carnês) and Pix API, and choose the scopes you want to authorize for Production and/or Homologation according to your needs (remember that these can be changed later).
  4. Click on Create New Application (Criar Nova aplicação).

Create a new application to use the Gerencianet API

Modify an existing application to use the Gerencianet API

  1. Access the Gerencianet dashboard and navigate to the API section.
  2. On the left side, click on My Applications (Minhas Aplicações), choose your application, and click on the Edit (Editar) button (orange button).
  3. Enable the Pix API and choose the scopes you want to authorize for Production and/or Homologation according to your needs (remember that these can be changed later).
  4. Click on Update Application.

Modify an existing application to use the Pix API

How to generate a Pix certificate #

All Pix requests must contain a security certificate provided by Gerencianet within your account, in PFX (.p12) format. This requirement is fully described in the PIX Security Manual.

To generate your certificate:

  1. Access the Gerencianet dashboard and navigate to the API section.
  2. On the left side, click on My Certificates and choose the environment in which you want the certificate: Production or Homologation.
  3. Click on New Certificate.

To generate your certificate

How to convert a Pix certificate #

⚠️To use it in Flutter, the certificate must be converted to .pem format, and it is necessary to create a private key for the certificate.

You can download the certificate converter provided by Gerencianet.

Or use the example below by running the OpenSSL command for conversion.

OpenSSL Command

# Generate separate certificate and key
openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys #certificate
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes #private key

Add the certificate and private key to your project #

In the root of your project, create a new folder called certificates and put your newly created certificate and private key inside.

├── certificates
│   ├── private_key.pem
│   ├── certificate.pem
├── lib
│   ├── src
│   └── main.dart
├── .gitignore
├── analysis_options.yaml
└── pubspec.yaml

If you are using Flutter

if you are using Flutter with this library, you also need to add your certificates folder to the assets configuration in your pubspec.yaml file.

flutter:
  assets:
    - certificates/

How to register Pix keys #

The registration of Pix keys can be done through the Gerencianet mobile application or through an API endpoint. Below are the steps to register them.

Register Pix key through the mobile application

If you haven't installed our application yet, click on Android or iOS, according to your smartphone's operating system, to download it.

To register your Pix keys through the application:

  1. Access your account through the Gerencianet app.
  2. In the side menu, tap on Pix to start the registration.
  3. Read the information displayed on the screen and click on Register Key (Registrar Chave). If this is not your first registration, tap on My Keys (Minhas Chaves) and then on the icon (➕).
  4. Select the data you want to register as your Pix Key and tap Next (avançar) – you must choose at least 1 of the 4 available key options (phone number, email, CPF, and/or random key).
  5. After registering the desired Pix keys, click on Finish (concluir).
  6. Done! Your keys are now registered with us.

Usage #

import 'package:gerencia_net_plus/gerencia_net_plus.dart';

final certificateBytes = File('certificates/my_application_certificate.crt.pem').readAsBytesSync();
final privateKeyBytes = File('certificates/my_application_private_key.key.pem').readAsBytesSync();

final gerenciaNetPlus = GerenciaNetPlus(
    credentials: GerenciaNetCredentials(
      clientId: 'Client_Id',
      clientSecret: 'Client_Secret',
      certificateBytes: certificateBytes,
      privateKeyBytes: privateKeyBytes,
      pixKey: 'pixKey',
      sandbox: true,
    ),
  );

final newCharge = await gerenciaNetPlus.pix.immediateCharge.createCharge(value: 100);

Examples #

You can check all the available examples by clicking here.

Additional Documentation #

Project's Github: https://github.com/cardosoOReis/gerencia_net_plus;

GerenciaNet Api documentation: https://dev.gerencianet.com.br/docs;

Official Gerencia Net Discord: https://discord.com/invite/ptGHMtczcV;

License #

BSD 3-clause

0
likes
150
pub points
0%
popularity

Publisher

unverified uploader

A Dart plugin that allows a better way to connect to Gerencianet - Efí Api.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

dio, dio_http2_adapter, equatable, intl, pretty_dio_logger

More

Packages that depend on gerencia_net_plus