Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil).
Add this line to your application's Gemfile:
gem 'qrcode_pix_ruby'
And then execute:
bundle install
Or install it yourself as:
gem install qrcode_pix_ruby
- pix_key/url
- repeatable
- currency
- country_code
- description
- postal_code
- merchant_name
- merchant_city
- transaction_id
- amount
require 'qrcode_pix_ruby'
pix = QrcodePixRuby::Payload.new(
pix_key: 'minhachavedopix',
description: 'Pagamento do pedido 123456',
merchant_name: 'Fulano de Tal',
merchant_city: 'SAO PAULO',
transaction_id: 'TID12345',
amount: '100.00',
currency: '986',
country_code: 'BR',
postal_code: '01131010',
repeatable: false
)
# If needed, change the attributes value later
pix.pix_key = 'minhaoutrachavepix'
pix.merchant_city = 'BRASILIA'
# QRCode copia-e-cola
puts pix.payload
# QRCode for images
puts pix.base64
require 'qrcode_pix_ruby'
pix = QrcodePixRuby::Payload.new(
url: 'https://example.com',
merchant_name: 'Fulano de Tal',
merchant_city: 'SAO PAULO',
amount: '100.00',
transaction_id: 'TID12345',
repeatable: false
)
# If needed, change the attributes value later
pix.url = 'https://another-example.com'
pix.amount = 1.50
# QRCode copia-e-cola
puts pix.payload
# QRCode para uso em imagens
puts pix.base64
🚨 Important note: BACEN (Banco Central do Brasil) sets a variety of rules for each field in QRCode Payload (maximum number of characters, invalid values, mandatory and optional fields, and so on). So, pay attention that a QRCode payload+base64 generated by the gem can be valid, theorically, but may not be accepted in banking apps because of these restrictions (that are out of scope of gem).
To execute gem tests locally, use Docker with the commands below:
git clone https://github.com/pedrofurtado/qrcode_pix_ruby
cd qrcode_pix_ruby/
docker build -t qrcode_pix_ruby_specs .
# Then, run this command how many times you want,
# after editing local files, and so on, to get
# feedback from test suite of gem.
docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs
To execute demo locally, use Docker with the commands below:
git clone https://github.com/pedrofurtado/qrcode_pix_ruby
cd qrcode_pix_ruby/demo/
docker build -t qrcode_pix_ruby_demo .
# Then, access http://localhost:3000 the see demo in action.
docker run -p 3000:3000 -it qrcode_pix_ruby_demo
- https://github.com/joseviniciusnunes/qrcode-pix
- https://www.bcb.gov.br/content/estabilidadefinanceira/forumpireunioes/AnexoI-PadroesParaIniciacaodoPix.pdf
- https://github.com/renatomb/php_qrcode_pix
- https://www.gerarpix.com.br
- https://github.com/fbbergamo/gerador-pix
- https://pix.ae
- https://pix.nascent.com.br/tools/pix-qr-decoder
- https://openpix.com.br/qrcode/scanner
- https://openpix.com.br/qrcode/debug
- https://github.com/william-costa/wdev-qrcode-pix-estatico-php
- https://github.com/william-costa/wdev-qrcode-pix-php
- https://www.youtube.com/watch?v=eO11iFgrdCA
- https://qrcodepix.dinheiro.tech
- http://decoder.qrcodepix.dinheiro.tech
- https://www.bcb.gov.br/estabilidadefinanceira/pix
- https://gerencianet.com.br/blog/qr-code-estatico-qr-code-dinamico-no-pix
- https://blog.juno.com.br/pix-qr-code-estatico-x-qr-code-dinamico
- https://github.com/entria/awesome-pix
- https://zxing.org/w/decode.jspx
- https://github.com/hiagodotme/gpix
- https://github.com/EnssureIT/faz-um-pix
- https://github.com/jesobreira/pixkey
- https://github.com/pedrinholemes/pix-br
- https://github.com/ceciliadeveza/gerarqrcodepix
- https://www.bcb.gov.br/content/estabilidadefinanceira/SiteAssets/Manual%20do%20BR%20Code.pdf
- https://www.bcb.gov.br/content/estabilidadefinanceira/spb_docs/ManualBRCode.pdf
Bug reports and pull requests are welcome on GitHub at https://github.com/pedrofurtado/qrcode_pix_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the qrcode_pix_ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.