Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

pix_brcode is an Elixir library for generating and parsing Pix BR Codes—not a complete integration with a bank or payment service provider. Its creator, Igor Giamoniano, says a real-bank test with a R$ 0.01 payment confirmed one generated code worked end to end, while codes from bank apps revealed a case-sensitivity mismatch that his specification-based tests had missed.

What pix_brcode does—and what it does not

The library handles Pix BR Code payloads: the structured data used in a Pix QR code or its copy-and-paste representation. Giamoniano says it can generate and parse those payloads, validate generated fields such as merchant names, and handle amounts as integer cents or exact strings rather than binary floating-point values. He also describes the implementation as having no dependencies and using a handwritten CRC16 routine. These are the author’s descriptions; the implementation has not been independently audited here.

That scope is narrower than Banco Central’s API Pix. API Pix is a separate specification for services provided by a receiving payment service provider (PSP), including charge management, Pix and refund monitoring, and queries. It supports recipients who want to automate interactions with their PSP; a BR Code library should not be mistaken for that integration. Banco Central’s API Pix repository describes the API specification as OpenAPI 3.0 and identifies release 2.10.0; that is the API specification’s release, not the Elixir package’s version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why a one-cent payment mattered

Giamoniano says his first attempts to scan a generated code failed because he had used a made-up Pix key. After switching to his own Itaú random key, he generated a code for R$ 0.01. He reports that Nubank displayed his name and the amount, and that the payment arrived in his Itaú account. He called it “The best-invested cent of my life.”

This is a reported end-to-end check of one generated code with a real key and a real payment. It demonstrates that this particular payload worked across that flow; it does not establish compatibility with every bank, key type, Pix payment path, or payload.

What bank-generated codes taught the parser

The more consequential lesson was a difference between the written format and observed bank-app output. Giamoniano says his initial parser expected the Pix GUI identifier in lowercase, br.gov.bcb.pix, as specified in the manual. Codes he examined from Nubank and Itaú used the uppercase form BR.GOV.BCB.PIX. His tests against the expected format had not exposed that variation.

He says he changed parsing to compare the identifier without regard to case, while keeping generated output lowercase to match the manual. That is a useful compatibility distinction: emit the specified form, but avoid rejecting otherwise usable input solely because a bank varies its capitalization.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bank-generated payloads also differed in their postal-code and receiver-name fields, according to the author. Those examples informed anonymized payload layouts he added; they do not show that all banks use one identical layout. As he puts it, “The spec is the minimum. Real systems have variations that only show up with real data.”

How a Pix BR Code is structured

A BR Code is organized as a sequence of tag-length-value (TLV) fields. Some fields contain nested account information for Pix, and a CRC16 checksum appears at the end of the payload. The structure lets software identify fields and check whether the payload changed accidentally.

CRC16 is an integrity check, not a security mechanism. It can help detect accidental corruption, but it does not authenticate the sender, prove that a key belongs to the intended recipient, or protect a payment from fraud. The separate API Pix specification likewise says security is outside its scope and points to distinct security and initiation manuals; those API documents concern PSP services, not the Elixir package itself. The official API Pix repository is the source for that scope statement.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When the library may help an Elixir developer

  • Generating a Pix BR Code: Useful when an Elixir application needs to construct a payment payload, with input validation and exact amount handling described by the author.
  • Parsing a copia e cola payload: Relevant when an application needs to inspect the structured contents of a Pix BR Code pasted as text.
  • Investigating “Invalid QR Code” errors: A rejected scan can reflect malformed data, a key or field problem, or an interoperability difference. The author’s casing experience is one documented example, not a universal diagnosis.
  • Building PSP workflows: If the requirement is creating charges, monitoring transactions or refunds, or querying a provider, investigate the provider’s API and API Pix requirements separately; BR Code parsing and generation alone do not implement those services.

The author says the project was inspired by JavaScript’s pix-utils and by his view that Hex lacked a maintained equivalent. He reports releasing pix_brcode as v0.1.0, but that historical release detail does not establish the package’s current version or maintenance status. Check the package’s own Hex and documentation pages before relying on a particular API or release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.