How to filter SAT invoices?

The objective of this article is to share with users how to filter SAT transactions (invoices, or, more technically speaking, CFDIs) that are synchronized through Syncfy. This is possible through a filtering tool that Syncfy offers us called Keywords, this filtering tool can be used on both GET /attachments and GET /transactions endpoints. What this tool consists of is explained below.

Keywords for CFDI

In Mexico there are different tax documents whose issuance is mandatory for a taxpayer depending on their tax regime, the main tax documents are the following:

  • Facturas
  • Recibo de Honorarios
  • Recibos de Pago
  • Recibo de Arrendamiento
  • Recibo de Donativos
  • Nota de Cargo
  • Nota de Crédito
  • Nota de Devolución
  • Carta Porte
  • Recibo de Nómina
  • Etcétera

In order to standardize these documents, the SAT defined a structure called CFDI (Comprobante Fiscal Digital por Internet)(by its initials in Spanish), it is an XML document that contains the following elements:

Main Node: cfdi:Comprobante
Secondary Node: cfdi:Emisor
Secondary Node: cfdi:Receptor
Secondary Node: cfdi:Conceptos
Secondary Node: cfdi:Impuestos
Secondary Node: cfdi:Complemento

  • A “Recibo de Nómina CFDI 3.2” has the child node ‘nomina:Nomina’ inside secondary node ‘cfdi:Complemento’ and in the attribute ‘tipoDeComprobante’ the value ‘egreso’.
  • A “Carta Porte” has the word “traslado” inside the attribute ‘tipoDeComprobante’ of the ‘cfdi:Comprobante’ node.

When we try to answer the question: What are the values ​​and nodes of each tax document? We find that there are no rules defined by the SAT for all of them, at least for the most colloquial, they are more than anything a convention and in fact we can find that the conditions (sometimes) are based on the criteria of each accountant, For this reason, Paybook Sycfy opted for the use of Keywords which are extracted from attributes and representative nodes of the CFDI and through them it can be inferred if a CFDI can be classified as a specific tax document.

Thus, the keywords of each transaction are extracted from the following sources:

  • From the SAT portal the values “emitidas”, “recibidas”, “vigente” and “cancelada” ​​are extracted.
  • Attribute version from the CFDI, the values ​​it can take are “2,2”,”3.2” and “3.3”. It is important to specify the version as the conditions of each tax document are likely to change depending on the version.
  • Attribute TipoDeComprobante from the CFDI, the values ​​it can take are “ingreso”, “egreso” and “traslado”.
  • Attribute “impuesto” from the node “cfdi:Retencion”, For example, from the invoice described in the figure below we will obtain the keywords “IVA” and “ISR”.

  • Each of the names of the nodes that appear inside “cfdi:Complemento”.

Below are Sycfy’s proposals for filtering the most popular tax documents when performing a transaction query:

“Recibo de Honorarios”{{token}}&keywords=3.2,ingreso,iva,isr

“Recibo de Donativos”
Version 1.0:{{token}}&keywords=3.2,ingreso,donat
Version 1.1:{{token}}&keywords=3.2,ingreso,donat11

“Nota de Crédito”{{token}}&keywords=3.2,egreso,iva&skip_key words=nomina

“Carta Porte”{{token}}&keywords=3.2,traslado

“Recibo de Nómina”{{token}}&keywords=3.2,egreso,nomina

Invoices from Educational Institutions{{token}}&keywords=3.2,egreso,iedu

The keywords also allow you to filter the invoices by their tax behavior, for example:

List only all invoices except the “recibidas con IVA Trasladado”{{token}}&keywords=3.2,ingreso,traslados,iva

List only all invoices except the “recibos de nómina”{{token}}&keywords=3.2,ingreso&skip_keywor ds=nomina

List only the “recibos de nómina”{{token}}&keywords=3.2,nomina