Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to parse a CFDI 4.0 in C# without suffering (and without tripping over SAT details)

Si trabajas con facturación electrónica en México, tarde o temprano te toca leer un XML de CFDI: para conciliar pagos, cargar facturas recibidas en un ERP o mostrarle al usuario qué le facturaron. Parece fácil. Es un XML, ¿no? Luego te topas con los namespaces, con el timbre metido en un complemento, con facturas 3.3 que siguen circulando y con impuestos que a veces no traen importe. Aquí va cómo…

Translated from Spanish Read in Spanish

The article discusses how to properly parse XML files of electronic invoices (CFDI) in Mexico using C# with System.Xml.Linq. It highlights common issues such as namespaces, digital stamps, and tax information. The article provides a step-by-step guide on how to securely load XML files, detect the version of the invoice, and extract basic data such as issuer and recipient information, totals, and UUID.

It also warns about potential errors when dealing with exempt taxes and provides code snippets to handle these cases. The guide supports both CFDI 3.3 and 4.0 versions.

Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Transition from Laravel to .NET

Sempre fui um grande fã de tecnologias microsoft. Tomei uma decisão a respeito do meu futuro. Atualmente, trabalho com Laravel e com o ecossistema PHP, mas resolvi voltar a estudar a tecnologia que eu…

More from Sunday 27 September →