Integrations

Mexico Electronic Invoicing

Accountability-Click Factura Integration Overview

Last updated February 4, 2024

Introduction

The Mexican government required all businesses to use electronic invoices and live reporting to the tax authorities as of 2014. The process is designed around the CFDI (Comprobante Fiscal Digital por Internet) electronic invoice, which consists of (a) an XML file and (b) a PDF version. The electronic invoice is digitally certified by the Mexican Servicio de Administración Tributaria (SAT). 

This document describes Accountability’s e-invoicing functionality for Mexico through our integration with Click Factura.  Click Factura is a government-approved electronic invoicing company in Mexico. To leverage this integration, the following prerequisites must be met: 

  1. The agency must register with SAT for a Federal Taxpayer Registration.
  2. The agency must obtain a unique electronic signature key (FIEL) and Certificado de Sello Digital (CSD) digital stamp for SAT.
  3. The agency must be a Click Factura customer. 

Mexico electronic invoicing

Overview

The diagram below describes Accountability’s integration with Click Factura for e-invoicing.

  1. Client invoices 
    1. The approved Accountability invoice is automatically transmitted to Click Factura. 
      Note:  Best practice is to date the invoice with the same date that you're sending it for stamping. The Invoice Date is automatically updated to the current date if the Invoice Date in Accountability is prior to the current date.   
    2. Click Factura verifies the details of the API message, then creates a zip file containing a PDF version of the invoice and an XML file. 
    3. Click Factura sends the invoice details, electronic signature key, and tax registration details to the SAT portal for validation 
    4. The digitally certified invoice is sent back to Accountability, attached to the invoice generated from the platform, then e-mailed to the client 
  2. Cash receipts 
    1. The approved Accountability client invoice payment (aka “receipt”) is automatically transmitted to Click Factura. Note" Receipts can only be issued 3 days (or more) after the invoice date. 
    2. Click Factura sends the receipt details, electronic signature key, and tax registration details to the SAT portal for validation 
    3. The digitally certified receipt is sent back to Accountability, attached to the invoice generated from the platform, then e-mailed to the client

Click Factura Configuration in Accountability

The following details are sent from Accountability to Click Factura. The file has multiple sections. 

 

 File section/example

 Description

 COMPROBANTE section

 Document data

 comprobante comprobante = new   comprobante();

 comprobante.ambientePrueba = true;

 

 folio=

 Internal invoice number

 Populated with the Accountability client   job invoice number without the prefix, e.g.   “000435” will be sent for client job invoice   “P0000435”

 serie=

 Invoice Series

 Populated with the Accountability client   job or sundry invoice prefix, e.g. a client job   invoice would normally be a “P”

 fecha=

 Invoice Issue Date

 This is populated with the invoice approval   date in datetime format, e.g., " 2016-01-   15T16:41:24”

 LugarExpedicion=

 Expedition Place

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,   LugarExpedicion="MEXICO,

  CIUDAD DE MEXICO"

 Moneda=

 Currency

 Currency code on the client job or sundry   invoice, e.g. MXN, USD, etc.

 formaDePago=

 Form of Payment

 This is stored in the Job CDFI Settings.

 metodoDePago=

 Method of Payment

This is stored in the Job CDFI Settings.

 numeroCuenta = ""

 

 condicionesPago = ""

 

 TipoCambio="1.0000"

 Exchange Rate

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice,   e.g.,TipoCambio="1.0000"

 subTotal=

 Sub-total

 The Client Job or Sundry Invoice total   excluding tax, e.g.,   subTotal="82500.000000" 

 Note:  This shows a positive value even if it’s   a negative amount.  See tipoCombrobante.

 tipoComprobante=

 If the invoice amount =>0 then “ingreso”   else “egreso”

 total=

 Total 

 The Production Invoice/Sundry Invoice total   including tax, e.g. total="95700.000000"   note even if it is a negative value show the   positive value)

 comprobante.descuento = 0.00m;

 Discount

 comprobante.motivoDescuento = "";

 Discount Description

 comprobante.folioFiscalOriginal = "";

 comprobante.serieOriginal = "";

 comprobante.fechaOriginal =   DateTime.Now;

 comprobante.referenciaPago

 comprobante.fechaPago

 These are not sent to Click Factura

 comprobante.logo = ""

 This is not sent to Click Factura.  CF stores   the logo in their database. 

 EMISOR Section

 Company Address Data

 emisor emisor = new emisor();

 

 rfc=

 Tax Number

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,rfc= "RPI041013P7A"

 nombre=

 Name

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,nombre="Global   Agency Inc.”

 calle=

 Street

 This is stored in the Notes for the Office and   sent with the API message based on the .   office of the invoice, e.g.,  calle= "Rio Rhin"

 noExterior=

 External Number

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g., noExterior="27"

 noInterior=

 Internal Number

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g., noInterior= "Piso 4"

 colonia=

 Sub-district

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,   colonia="Cuauhtemoc"

 municipio=

 District/Municipality

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,  municipio   ="Cuauhtemoc"

 codigoPostal=

 Postal Code

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,   codigoPostal="06500"

 Localidad=

 Location

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g., localidad=   "CIUDAD DE MEXICO”

 pais=

 Country

 This is stored in the Notes for the Office   and   sent with the API message based on   the   office of the invoice, e.g.,  pais= "Mexico"

 estado=

 State

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,  estado= "CIUDAD   DE MEXICO”

 emisor.referencia = "";

 

 Regimen=

 Tax Regime

 This is stored in the Notes for the Office and   sent with the API message based on the   office of the invoice, e.g.,   Regimen=   "Regimen General de las personas morales."

 RECEPTOR section

 Client Address Data

 rfc=

 Tax Number

 Company Number from the Client record.

 nombre=

                                        

 Name

 Client Name on the invoice. 

 calle=

 Street

 Client Contact Address on the invoice 

 receptor.noExterior = ""

 Leave blank, we don’t store this in   AccountAbility

 receptor.noInterior = ""

 Leave blank, we don’t store this in   AccountAbility

 colonia=

 Sub-district

 Client Contacts Address 2 on the invoice 

 municipio=

 District/municipality

 Client Contacts City on the invoice 

 codigoPostal=

 Postal code

 Client Contacts Zip Code on the invoice 

 localidad=

 Location

 Client Contacts State on the invoice

 pais=

 Country

 Client Contact .Country on the invoice

 estado=

 State

 Client Contacts State on the invoice

 receptor.referencia = "";

 

 

 

 Concepto Section 

 Services

 Line items or invoice tot, dependent on the   invoice type, i.e. client job invoice vs sundry   invoice 

 IF Sundry Invoice

 Accountability creates one ‘Concepto’   record for each sundry invoice line item. 

 cantidad= (means quantity)

 Quantity

 Sundry invoice entry units, .e.g., “1”

 descripcion=

 Line item description 

 conceptoUno.desglosaIVA = true

 VAT-eligible

 conceptoUno.noIdentificacion = ""

 

 unidad= (means unit)

 "No Aplica"

 valorUnitario= (means unit value)

 Unit price

 IF tipoComprobante= “ingreso”, show the   line item rate, 

 ELSE rate * -1

 PorcentajeIVA

 VAT percentage

 IF Client Job Invoice

 We are going to create a single ‘Concepto’   record for each client job invoice line item,   plus a line  for ‘AGENCY FEE’

 cantidad= (means quantity)

 Quantity

 Units on the line item.  This is set to ‘1’ if the   unit is zero.

 descripcion=

 Line item description 

 conceptoUno.desglosaIVA = true

 

 conceptoUno.noIdentificacion = ""

 

 unidad= (means unit)

 "No Aplica"

 valorUnitario= (means unit value)

 Unit price

 IF tipoComprobante= “ingreso”, show the   invoice subtotal 2,  else(sub-total   2/cantidad) *-1

 PorcentajeIVA

 VAT percentage

 If Production_Invoice_Entries.Tax = 0, then   0, ELSE   (Production_Invoice_Entries.Tax*100)/(   Production_Invoice_Entries.SubTotal2+   Production_Invoice_Entries.ServiceFee)

 One ‘AGENCY FEE’ record (we only   create this record if the sum of all   Production_Invoice_Entries.ServiceFee   records is <> 0)

 

 cantidad= (cantidad means quantity)

 “1”

 descripcion=

 “AGENCY FEE”

 conceptoUno.desglosaIVA = true

 

 conceptoUno.noIdentificacion = ""

 

 unidad= (means unit)

 "No Aplica"

 valorUnitario= (means unit value)

 IF tipoComprobante= “ingreso”

 Sum of all   (Production_Invoice_Entries.ServiceFee)

 where ProductionInvoiceID = this invoice

 ELSE

 ((Production_Invoice_Entries.ServiceFee)

 where ProductionInvoiceID = this invoice

 )*-1

 PorcentajeIVA

 If the sum of all   Production_Invoice_Entries.Tax = 0, then 0,   ELSE

 Step 1: Sum all   Production_Invoice_Entries.SubTotal where   ServiceFee <> 0

 Step 2: Sum all   Production_Invoice_Entries.ServiceFee   where ServiceFee <> 0

 Step 3: Sum all   Production_Invoice_Entries.Tax where   ServiceFee <> 0

 Step4: ((Step 3*100)/(Step1+ Step2)

 Acciones Section (email)

 

 acciones.enviarEmail = false;

 acciones.emailEnvio = "";

 acciones.emailEnvioCopia = "";

 acciones.emailEnvioCopiaOculta = "";

 acciones.emailHtml = "";

 

Example Office Configuration

Confirm the URL with Click Factura. This URL is based on the version of the platform that your agency is on.

version="4.0"
cfdi uri="http://clickfactura.com.mx/api/timbrado/timbraxml/xxx/timbrarprod"

cancel uri="http://clickfactura.com.mx/api/timbrado/timbraxml/xxx/cancelar"

ambientePrueba="false"

LugarExpedicion="11550"

TipoCambio="1.0000"

formaDePago="PAGO EN UNA SOLA EXHIBICION"

metodoDePago="No identificado" 

nombre="SERVICIOS DIGITALES RAW TALENT"

rfc="SDR1911015L1" 

calle="HORACIO"

codigoPostal=11550"

colonia="POLANCO"

estado="CDMX"

localidad="CDMX" 

municipio="MIGUEL HIDALGO"

noExterior="1022"

noInterior="NA"

pais="MEXICO"

Regimen="601"  

user="agencyname"

password="password123#"

email="first.last@clickfactura.mx"

Use Mexico XML

Media Report Currency2='USD'

Job Setup 

If the Office is configured for CFDI (Comprobante Fiscal Digital por Internet) electronic invoices, the CFDI Settings option will appear on the Settings menu list.

CDFI Settings

Select from the pick-list of valid options for the following fields: 

Setting Description
UsoCFDI Select from a list a CFDI usage code that's defined by the SAT, e.g. G01 (Acquisition of Goods)
FormadePago Select from a list of payment method codes that the SAT has defined, e.g.  03 (Bank Transfer)
claveProdServ Select from a list of product codes defined by the SAT, e.g.  Servicios edioriales y de soporte
metodoDePago Select from a list of payment terms codes defined by the SAT, e.g. PPD (Installment or Deferred)

 

This process is new as of February 4, 2024. Prior to this date, agencies used custom labelers on Jobs to define these settings.