Skip to content

Interface fácil de usar para integração de apps em Flutter com a API Pix do Banco do Brasil.

License

Notifications You must be signed in to change notification settings

AcxTechSistemas/pix_bb

Repository files navigation

Pix BB - Easy to use interface for integrating with Banco do Brasil's Pix API in your Flutter Apps.


Logo

This package offers an easy-to-use interface for integrating with Banco do Brasil's Pix API. With this package, you can get transaction information quickly and efficiently in your Flutter apps.
Explore the docs »

Report Bug · Request Feature


License Pub Points Contributors Forks

Pub Publisher


[v1.0.0] Breaking Changes

  • Changed variable name in PixBB Instantiate :

    • dev_app_key => developerApplicationKey
  • Changed the way to use the fetchTransaction method:

    • Before
final listPix = await pixBB.fetchRecentReceivedTransactions(
  accessToken: token.accessToken,
);
  • After
final listPix = await pixBB.fetchTransactions(
  token: token,
);
//Returns the last 4 days transactions
final listPix = await pixBB.fetchTransactions(
  token: token,
  dateTimeRange: DateTimeRange(
    start: DateTime.now().subtract(Duration(days: 1)),
    end: DateTime.now(),
  );
);
//Returns the transactions of the specified date range
// Attention the maximum difference between the dates must be 4 days


Table of Contents
  1. About The Project
  2. How To Use
  3. Features
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgements

About The Project


Pix Banco do Brasil PNG


This package offers an easy-to-use interface for integrating with Banco do Brasil's Pix API. With this package, you can get transaction information quickly and efficiently in your Flutter apps.

(back to top)

Pre Requirements

  • Key Pix registered with Banco do Brasil
  • Exclusive for legal entities
  • Registration on the BB Developers Portal

Getting Started

To install This package in your project you can follow the instructions below:

a) Add in your pubspec.yaml:

 dependencies:
    pix_bb: <last-version>

b) or use:

 dart pub add pix_bb

(back to top)

How To Use

This package is ready for get transactions information quickly!

First instantiate the class passing the appropriate parameters

final pixBB = PixBB(
  ambiente: Ambiente.homologacao,
  basicKey:'BASIC_KEY',
  applicationDeveloperKey: 'APP_DEV_KEY',
);

Make a request to the API with request a list of transactions received from the last 4 days

    await pixBB.getToken().then((token) {
      pixBB
          .fetchTransactions(token: token)
          .then((response) {
        print(response); // it's a List<Pix>.
      }).catchError((e) {
        print(e);
        // It's a PixException.
        //This package provides several ways to handle errors that may occur.
        //see the docs!
      });
    });

For more examples, please refer to the Documentation

(back to top)

Features

  • ✅ Queries
    • ✅ Get Recent Transactions
    • ✅ Get Transactions By Date

  • 🚧 Dynamic QR Code configuration: Creation of Pix billing with unique identification;
  • 🚧 Receipt Verification: Status verification of generated charges;
  • 🚧 Review: Allows you to change the generated billing data;
  • 🚧 Return (request and consultation): Allows Pix to be returned to the payer in partial or full amount and that returns can be consulted.

(back to top)


Use cases

Request an access token

Request a token

final token = await pixBB.getToken();

Fetch Pix Transactions

  • Default Time Range
final listPix = await pixBB.fetchTransactions(
  token: token,
);
//Returns the last 4 days transactions
  • Custom Time Range
final listPix = await pixBB.fetchTransactions(
  token: token,
  dateTimeRange: DateTimeRange(
    start: DateTime.now().subtract(Duration(days: 1)),
    end: DateTime.now(),
  );
);
//Returns the transactions of the specified date range
// Attention the maximum difference between the dates must be 4 days

Handling errors

This package provides some ways to map and handle different types of errors, Below are some of the errors that can be encountered when using this package:

  • difference-between-dates-too-long: A Diferença entre as datas de inicio e fim da consulta são maiores que 4 dias.
  • empty-basic-key: Basic key vazia ou não definida
  • empty_app_dev_key: Application developer key vazia ou não definida

Contributing

🚧 Contributing Guidelines - Currently being updated 🚧

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the appropriate tag. Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Remember to include a tag, and to follow Conventional Commits and Semantic Versioning when uploading your commit and/or creating the issue.

(back to top)

License

Distributed under the MIT LICENSE.txt for more information.

(back to top)

Aknowledgements

Thank you to all the people who contributed to this project, whithout you this project would not be here today.

(back to top)

Maintaned by



Built and maintained by AcxTech Sistemas.