CryptoSys Home > FirmaSAT > QR code for CFDi

QR code for CFDi


This page shows how to create a QR code for a CFDi v4.0/v3.3 document using our diQRcode library. You can download the latest version of diQRcode here.

The specification for the QR code is the same for CFDi versions 3.3 and 4.0.
Latest Reference: "Anexo 20 de la Resolución Miscelánea Fiscal para 2022, publicada en la edición vespertina del 27 de diciembre de 2021." Page 67. D. Especificación técnica del código de barras bidimensional a incorporar en la representación impresa.
Official SAT reference: Anexo20_2022.pdf (6.4 MB). Relevant pages: v4.0 page 67 (previously v3.3 page 60)

Example text

From SAT's reference document:
https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id=5803EB8D-81CD-4557-8719-26632D2FA434&re=XOCD720319T86&rr=CARR861127SB0&tt=0000014300.000000&fe=rH8/bw==
where

SAT

Using the command-line to create a PDF file

> diqrc --pdf sat.pdf "https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id=5803EB8D-81CD-4557-8719-26632D2FA434&re=XOCD720319T86&rr=CARR861127SB0&tt=0000014300.000000&fe=rH8/bw=="
Created file 'sat.pdf'.

This will create a PDF file of the exact size of the QR code image, in this case 3.74 x 3.74 cm, with the default 2 pixels per module. There are options to position the QR code image at a variable position inside a larger PDF page.

You can also create GIF and SVG images directly and generate the base64 encoding to embed the images directly in an HTML file.

Calling from your program

.NET

Use the QRcode.CreatePdf Method or QRcode.CreateImage Method.
string tt = "https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id=5803EB8D-81CD-4557-8719-26632D2FA434&re=XOCD720319T86&rr=CARR861127SB0&tt=0000014300.000000&fe=rH8/bw==";
int n = QRcode.CreatePdf("sat.pdf", tt);
Debug.Assert(0 == n, "QRcode.CreatePdf failed");

For more information, see the diQRcode Documentation page

Contact us

To contact us or comment on this page, please send us a message.

[Go to top]

This page last updated 21 March 2022