What is Pix copia e cola?
Pix copia e cola (copy-and-paste code) is the text behind a Pix QR code. It is a string of characters in the BR Code standard (EMV QR Code Merchant Presented Mode, adapted by the Central Bank of Brazil) that the payer pastes into their app instead of scanning an image. Every Pix QR code has a corresponding Pix copia e cola and vice versa; the generator above shows both at the same time, and the "Show the code" block is already open on this page.
How to generate the text
- Fill in the key, name and city and, if you want, the amount, identifier and description.
- Click Generate. Below the QR you get the full text and a field-by-field list.
- Use "Copy Pix copia e cola" and send it by message. Send the whole text, from
000201to the four CRC characters, with no line breaks.
Anatomy of the code
The code is a list of fields in ID-length-value (TLV) format. Each ID has two digits, the length has two digits and the value has exactly that many characters. Fields 26 and 62 are blocks that contain subfields in the same format.
| ID | Field | Value in a static code |
|---|---|---|
| 00 | Payload Format Indicator | 01, always |
| 01 | Point of Initiation Method | omitted or 11 (reusable); 12 = single use |
| 26 | Merchant Account Information | subfield 00 = br.gov.bcb.pix, 01 = key, 02 = optional description |
| 52 | Merchant Category Code | 0000 when there is no category |
| 53 | Transaction Currency | 986 = Brazilian real (ISO 4217) |
| 54 | Transaction Amount | optional; decimal point, up to 2 places, e.g. 25.90 |
| 58 | Country Code | BR |
| 59 | Merchant Name | recipient name, up to 25 ASCII characters |
| 60 | Merchant City | city, up to 15 ASCII characters |
| 62 | Additional Data Field | subfield 05 = txid (up to 25 alphanumeric characters) or *** |
| 63 | CRC | CRC16-CCITT (polynomial 0x1021, initial 0xFFFF) of everything before it, including 6304 |
Worked example, field by field
The example from the Central Bank's manual, with a random key, name Fulano de Tal and city BRASILIA:
00020126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266554400005204000053039865802BR5913Fulano de Tal6008BRASILIA62070503***63041D3D
| Segment | Reading |
|---|---|
000201 | Field 00, 2 characters, value 01 |
2658 0014br.gov.bcb.pix 0136123e4567-…-426655440000 | Field 26 with 58 characters: subfield 00 (14) = Pix GUI, subfield 01 (36) = key |
52040000 | Merchant category 0000 |
5303986 | Currency 986 = BRL |
5802BR | Country BR |
5913Fulano de Tal | Name with 13 characters |
6008BRASILIA | City with 8 characters |
6207 0503*** | Field 62 with 7 characters: subfield 05 = txid *** |
63041D3D | CRC16 of everything before it, including 6304 |
Note that there is no field 54: the amount is left to the payer. If you provide an amount, the 54 segment goes between the currency and the country, as in 540525.90. With the single-use option, the segment 010212 goes right after 000201.
How the CRC is calculated
Field 63 uses CRC-16/CCITT-FALSE: polynomial 0x1021, initial value 0xFFFF, no reflection, calculated over the UTF-8 bytes of the whole text up to and including 6304, and written as four uppercase hexadecimal digits. It is an error detector, not a signature: it catches typing or pasting mistakes, but does not stop someone from generating a new code with a different key. That is why you should always check the recipient name on the app's screen. To check a code you received, use the Pix decoder; to check just the key, the key validator.
References
Central Bank of Brazil (BCB), Manual de Padrões para Iniciação do Pix, section on BR Code and static QR codes; EMVCo, EMV QR Code Specification for Payment Systems, Merchant Presented Mode.