Mexico
Enabling support for Mexico involves confirming prerequisites and product IDs, registering with the SAT (Servicio de Administración Tributaria) tax authority, and setting up credentials.
Prerequisites
-
A valid RFC (Registro Federal de Contribuyentes) obtained from the SAT
-
A valid E.Firma certificate obtained from the SAT
-
A valid CSD (Certificado de Sello Digital) certificate, obtained from the SAT
-
Enable the cancellation function on the SAT to use cancellation through Sovos
-
Add your transmission credentials to your Admin Settings or via the Configuration v2 resource (API)
Addenda
An optional non-regulated element at the end of the CFDI (Comprobante Fiscal Digital por Internet). Its content is commonly used for exchanging any auxiliary information as agreed upon between the supplier and the buyer, e.g., for exchanging additional business information about the business transaction or information to be used in the printable CFDI representation. The addenda element is not integrity protected, so it is not covered by the supplier's digital signature over the CFDI.
There are several addenda XSDs defined by trading partners or certain industry sectors. Most ERP systems can generate the information that is needed for these addenda. Some companies are using different addenda for different trading partners, so there could be multiple addenda in this sense. However, there can only be one addenda node per CFDI according to the CFDI schema.
Cadena original
A chain of characters separated by the “|” (pipe) character, resulting from the concatenation of selected CFDI data elements, which determines the CFDI’s uniqueness.
This original chain is also used as the unique input to calculate the supplier's CFDI digital signature (sello in Spanish). Notably, the CFDI specifications do not rely on the W3C Digital Signature standard to ensure the integrity and authenticity of the digital signature included in the CFDI.
The original chain does not include all data elements from the CFDI. It only includes a data subset such as supplier/buyer RFCs, CFDI type, date/time, total amount, currency, ZIP code (only the numbers), VAT, and the Series and Folio attributes, if present, among other data elements, including elements from complements, when available.
Not all CFDI elements are included in the original chain. So, two different CFDIs that differ in XML elements and are not in the original chain may end up having the same original chain and therefore the same signature. In other words, such CFDIs would be duplicates from a fiscal standpoint. Although the probability of such a collision is very low, customers can and should avoid it by ensuring that the CFDIs differ in at least one of the elements contained in the original chain, such as date or series/folio.
The detailed rules for building the original chain are specified in the Anexo 20 document. The official stylesheet for extracting the original chain is also available as part of the CFDI Technical Specifications document.
CFDI cancellation
If there are errors in the CFDI, the Mexican supplier must cancel it, as they can't issue an amendment. A supplier can cancel a CFDI using a PCCFDI, which in turn submits the cancellation to the SAT. Alternatively, they can cancel the CFDI manually through the SAT Portal. Beginning in 2022, SAT now requires suppliers to provide the reason for the cancellation and, in some scenarios, which CFDI will replace the one being canceled.
In certain circumstances, the supplier must obtain explicit approval from the buyer before cancellation. This means that the cancellation process is not authorized until the buyer approves it or 72 business hours have passed since the cancellation was issued — at which point, the approval becomes implicit. The buyer's acceptance or rejection is processed through the Buzón Tributario .
CFDI content and catalogs
Besides the mandatory elements of the CFDI required by the schema, there are also conditionally mandatory elements that are required, depending on the supported commercial transaction. It's the taxpayer's responsibility to investigate the fiscal obligations in this respect.
In addition, several content values must comply with additional rules specified in the catalogs that are part of the CFDI's technical specifications. For example, when providing a Mexican postal index or country codes, only those in the corresponding catalog are allowed.
According to the catalog rules, some numeric values must be rounded to a certain number of decimals. The catalogs are available on this SAT web page.
CFDI printable representation
In Mexico, there are specific rules on how to generate a printable (human-readable) representation of an XML CFDI. The printable version of the CFDI is optional for the supplier — unless the buyer specifically requires it. Typically, a printable version of the CFDI is in PDF format, but other formats may be used.
The XML CFDI and the printable representation may be transmitted through the same channel as the invoice or through different channels.
The requirements for the content shown in the printable representation of a CFDI are defined in the RMF under the rule Requisitos de las representaciones impresas del CFDI (as of 2023, this is the rule 2.7.1.7). The technical specifications for the QR Code are described in the Anexo 20 document, in the section Especificación técnica del código de barras bidimensional a incorporar en la representación impresa.
CFDI types
The CFDI schema supports different types of fiscal documents. To specify the document type, you must set the value of the TipoDeComprobante
CFDI attribute using one capital letter, as follows:
- I (Ingreso)
- For an invoice or debit note (nota de cargo)
- E (Egreso)
- For a credit note (nota de crédito)
- T (Traslado)
- For a bill of lading (carta de porte)
- N (Nomina)
- For a payslip
- P (Pago)
- For a payment
The clearance process is the same, regardless of the CFDI type.
CFDI validation
Buyers can only claim tax deduction on CFDIs received if the document contains the supplier's signature — a valid Timbre Fiscal Digital (Spanish: Digital Tax Stamp) complement where the SAT digital signature, the fiscal folio UUID, and the certification date are added by a PCCFDI. In addition, administrative sanctions may be imposed if fraudulent documentation is used to support the accounting.
As a result of the above, buyer validation of received CFDIs is a highly recommended process to ensure overall compliance with inbound e-invoicing processes in Mexico.
Complements
CFDIs are used for different activities or sectors. Sometimes, the CFDI is enough to document a transaction. However, in some cases, the core CFDI requires a complement (complemento in Spanish) to provide additional information required by regulation. A complement is an additional XML complex element within the CFDI.
Complements are regulated separately from the core CFDI and are specified using their own XSD schema, independent of the core CFDI schema. Complement content is also validated by the PCCFDI against the required validations and catalogs. During the signing process, the complement, if present, is also protected by the resulting digital signature.
Some complements have existed for years without change. However, new complements, or new versions of existing complements, are released from time to time. This can create situations where a new version may coexist with the old one until there is a legal requirement to use the new version and discard the old one. It is the supplier’s responsibility to ensure that the legally required version of the specific supplement is used.
The complete list of all regulated complements is available in the SAT’s Complements web page. Commonly used complements:
- Complemento para Recepción de Pagos
- Used by suppliers to report when they receive payment for a transaction that was previously documented using a primary CFDI. This complement's technical specifications are on this SAT web page, which lists the schema, the guidelines, and the catalog.
- Complemento para Comercio Exterior
- Used by suppliers who need to document export transactions. This complement's technical specifications are on this SAT web page, which lists the schema, the guidelines, and the catalog. Its catalog includes the country codes, the currency codes, and the number of decimals to be used for the different currencies.
Timbrado (CFDI certification)
Upon receiving a signed CFDI, the PCCFDI validates the XML schema and content, including the supplier’s signature. It then clears the CFDI by generating an XML complement that contains the SAT signature, a unique invoice number (folio fiscal in Spanish) tagged as a Universally Unique Identifier (UUID), the date, and other complementary data. Together, these fields form the proof of stamping (timbre in Spanish). There is a one-to-one correspondence between the UUID and the Cadena Original.
The CFDI must be submitted to the PCCFDI for clearance and the PCCFDI must certify the CFDI within the next 72 hours. Given Mexico’s four distinct time zones, it is crucial to specify the applicable time to avoid rejections due to timing.
Suppliers are advised to extract the LugarExpedicion value — the postal index where the CFDI is issued — and locate the time zone for that postal index’s location. The attribute Fecha (Spanish: date) in the CFDI should then be assigned this value.
The PCCFDI must report all certified CFDIs to the SAT in less than two hours.
Available products
-
MX_DOCUMENTO_1_2.0
-
mx_comprobante__4.0
-
mx_comprobante__3.3
-
mx_temp__1.0
-
mx_Demo_1_3.3
Issue invoice
Invoice clearance in Mexico is based on the Default business process, which follows this order: Mapping, Signing, Transmission, and Distribution.
The diagram below provides a detailed overview:
Step 1: Supplier creates the Standard Business Document
Every invoice sent to Sovos must be part of a Standard Business Document (SBD). This document includes a Standard Business Document Header (SBDH) and a Sovos Document node, which in turn includes a Sovos Canonical Invoice (SCI) - except when the Local Format is used. To create the SBD, follow the detailed instructions in the SBDH, Sovos Document, and SCI pages. In addition, we'll now take a closer look at some key elements within the SBD:
- SCI - Invoice
-
Node Required Attributes Value StandardBusinessDocumentHeader.Sender.Identifier Yes Authority="MX" Supplier's RFC StandardBusinessDocumentHeader.Receiver.Identifier Yes Authority="MX" StandardBusinessDocumentHeader.DocumentIdentification.Standard Yes urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 StandardBusinessDocumentHeader.DocumentIdentification.TypeVersion Yes 2.1 StandardBusinessDocumentHeader.DocumentIdentification.Type Yes Invoice StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Country
Child node Identifier: MX
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: ProcessType
Child node Identifier: Outbound
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: SenderDocumentId
Child node Identifier: A unique document ID
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: SenderSystemId
Child node Identifier: The system ID configured in the backend. This parameter is used to determine which notifications are returned to the client and what attachments they include, so as to meet the different needs. If
SenderSystemId
is not configured on the client side, it'll assume the default value of "DefaultSystemERP". For more information, see this topic.StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: CompanyCode
Child node Identifier: Supplier's RFC
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No Child node Type: BusinessCategory
Child node Identifier: BusinessToBusiness or BusinessToConsumer. The default mode is BusinessToBusiness when this node is omitted, so if the transaction is business to consumer this must be explicitly specified.
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Mapping.OutputSchema
Child node Identifier: Comprobante
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Mapping.TransformDocument
Child node Identifier: SCI-TO-LEGAL_INVOICE
StandardBusinessDocumentHeader.BusinessScope.Scope.BusinessService. BusinessServiceName Yes Default SovosDocument.SovosCanonicalInvoice.Invoice Yes SCI - Local Format - Invoice
-
Node Required Value StandardBusinessDocumentHeader.DocumentIdentification.Standard Yes http://www.sat.gob.mx/cfd/3 StandardBusinessDocumentHeader.DocumentIdentification.TypeVersion Yes 3.3 StandardBusinessDocumentHeader.DocumentIdentification.Type Yes Comprobante StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No (never use) Child node Type: Mapping.OutputSchema StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No (never use) Child node Type: Mapping.TransformDocument SovosDocument.SovosLegalDocument Yes The CFDI invoice Supported document types for the Local Format (XML) document:
-
"I" - "Income" for regular invoices, fee and lease receipts, etc.
-
"E" - "Expenditure" for credit notes etc.
-
"T" - "Transfer" for moving goods within the company with a necessity of legal possession validation.
-
"N" - "Payroll" for payroll receipts and associated expenses.
-
"P" - "Payment" for payment receipts etc.
Note:It is important to include all the mandatory nodes as specified in the SBDH schema. In case the information cannot be provided, and the respective mandatory node has not been mentioned on the current page, for example the receiver.identifier, the node can be left empty but must still be included in the SBDH.
-
- SBD Sample
- Below is a sample of the SBD. In addition, there's a full sample of the SBD in the Postman Samples page and the orange "Run in Postman" buttons on this page.
<sbd:StandardBusinessDocument xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:sbd="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:ad="http://www.sovos.com/namespaces/additionalData" xmlns:sci="http://www.sovos.com/namespaces/sovosCanonicalInvoice" xmlns:svs="http://www.sovos.com/namespaces/sovosDocument" xmlns:sov="http://www.sovos.com/namespaces/sovosExtensions"> <sbd:StandardBusinessDocumentHeader> <sbd:HeaderVersion>1.0</sbd:HeaderVersion> <sbd:Sender> <sbd:Identifier Authority="MX">ABC000101000</sbd:Identifier> <sbd:ContactInformation> <sbd:Contact>Sovos Support</sbd:Contact> <sbd:EmailAddress>support@sovos.com</sbd:EmailAddress> <sbd:FaxNumber>+1-212-555-1213</sbd:FaxNumber> <sbd:TelephoneNumber>+1-212-555-2122</sbd:TelephoneNumber> <sbd:ContactTypeIdentifier>Support</sbd:ContactTypeIdentifier> </sbd:ContactInformation> </sbd:Sender> <sbd:Receiver> <sbd:Identifier Authority="MX"/> <sbd:ContactInformation> <sbd:Contact/> <sbd:EmailAddress/> <sbd:FaxNumber/> <sbd:TelephoneNumber/> <sbd:ContactTypeIdentifier/> </sbd:ContactInformation> </sbd:Receiver> <sbd:DocumentIdentification> <sbd:Standard>urn:oasis:names:specification:ubl:schema:xsd:Invoice-2</sbd:Standard> <sbd:TypeVersion>2.1</sbd:TypeVersion> <sbd:InstanceIdentifier/> <sbd:Type>Invoice</sbd:Type> <sbd:MultipleType>false</sbd:MultipleType> <sbd:CreationDateAndTime>2010-01-01T00:00:00Z</sbd:CreationDateAndTime> </sbd:DocumentIdentification> <sbd:BusinessScope> <sbd:Scope> <sbd:Type>Country</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>MX</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>Mapping.TransformDocument</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>SCI-TO-LEGAL_INVOICE</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>Mapping.OutputSchema</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>Comprobante</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>CompanyCode</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>ABC000101000</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>SenderDocumentId</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>1234556</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>SenderSystemId</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>UAT101</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>ProcessType</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>Outbound</sbd:Identifier> </sbd:Scope> <sbd:Scope> <sbd:Type>BusinessProcess</sbd:Type> <sbd:InstanceIdentifier/> <sbd:BusinessService> <sbd:BusinessServiceName>Default</sbd:BusinessServiceName> </sbd:BusinessService> </sbd:Scope> <sbd:Scope> <sbd:Type>BusinessCategory</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>BusinessToBusiness</sbd:Identifier> </sbd:Scope> </sbd:BusinessScope> </sbd:StandardBusinessDocumentHeader> <svs:SovosDocument> <sci:SovosCanonicalInvoice> <inv:Invoice> *UBL Nodes* </inv:Invoice> </sci:SovosCanonicalInvoice> </svs:SovosDocument> </sbd:StandardBusinessDocument>
Step 2: Supplier sends the SBD to Sovos
The supplier sends a POST
request to the /documents endpoint.
To make this request, set the following request body parameters:
Name | Type | Required | Description |
---|---|---|---|
data | string | Yes | Set it to the SBD encoded in Base64, as created in step 1. |
dataEncoding | string | Yes | Always set it to "base64". |
- Request Sample
-
curl --location --request POST 'https://api-test.sovos.com/v1/documents' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer Gy5wXGen0aoYFxcSTCBaZG2nGsu0' \ --header 'x-correlationId: 057b5a5e-520c-4ea0-a948-9d583b4d121c' \ --data-raw '{ "data": "PD9...de4=", "dataEncoding" : "base64" }'
- Response Sample
-
{ "timestamp": 1605282724079, "status": 202, "success": true, "message": "Document Received", "data": { "documentId": "3add2b7104dc0049ff0bf410f57e0a19afaf" } }
Step 3: Sovos maps the SCI into CFDI
Upon receiving the SCI, Sovos maps the file into the required CFDI XML format.
This step will be skipped if the SBD contains the invoice in the local format (JSON).
Step 4: Sovos performs the schema validation
After mapping, Sovos performs a schema validation to determine whether the CFDI XML file conforms to the expected structure by validating it against the official schema.
Step 5: Sovos signs the CFDI
After the CFFI passes the schema validation, Sovos signs it with the configured CSD certificate. The CFDI Comprobante element attributes sello, noCertificado and certificado will be filled in during this operation.
Step 6: Sovos transmits the CFDI
Sovos transmits the signed CFDI XML file to the PCCFDI for clearance.
Step 7: PCCFDI processes the CFDI
Upon receiving the file, the PCCFDI will perform the clearance process (Timbrado, in Spanish), which includes a schema validation and several content validations, including the supplier's signature. The PCCFDI then clears it by generating an XML complemento that contains the PCCFDI signature, a PCCFDI-assigned unique invoice number (folio fiscal, in Spanish) tagged as a UUID, the date, and other complementary data. All these fields together constitute the proof of clearance (Timbre, in Spanish).
After performing its services, the PCCFDI sends the proof of clearance to Sovos. Sovos will put together the CFDI and the proof of clearance.
Step 8: Sovos generates the PDF
Sovos generates a PDF that includes the content of the CFDI XML based on the configured PDF template.
Step 9: Sovos distributes the PDF and the CFDI
As explained in step 11, the supplier can retrieve the CFDI XML and the PDF via a GET API request. But Sovos can also distribute the PDF and the CFDI XML to the supplier using one of the following options:
-
Email
-
AS2
-
SFTP
-
Web Services
The delivery method must have been preconfigured, otherwise this step will be skipped.
Step 10: Storing
Sovos stores the PDF and the CFDI XML.
Step 11: Supplier Retrieves the Application Responses
It is highly recommended that clients configure their Application Response attachments as download links instead of base64 encoded data to avoid potential size limitations when retrieving responses. The default option is download links.
-
When using download links the response contains a URL from where the file can be downloaded.
-
When using binary data, the file itself is embedded in the response encoded in base64.
This configuration is available through our Professional Services team.
As a response to the initial sending of the document, the client will receive a JSON response message with an HTTP status code of 202 (asynchronous transaction). This means that the supplier must retrieve the application responses that become available during the transaction. These responses provide status information and also include a URL to access the cleared DTE and PDF once these have become available during the process.
To complete a transaction, the supplier must retrieve application responses until the SCIResponseCode
in the response has the value of either "AP" or "RE", which indicates that the transaction is finished. A successful transaction will generate five application responses, as shown in the table below:
SCICloudStatusCode | SCIResponseCode |
---|---|
101 | IP |
102 | IP |
103 | IP |
106 | IP |
200 | AP/CA |
The supplier can use the following COAPI endpoints to retrieve application responses:
- GET /notifications/MX
- The supplier can send a
GET
request to the /notifications/MX endpoint to retrieve application responses that match the set search criteria. This endpoint allows setting the following query parameters:Name Type Required Default Description taxId string No Set it to include only notifications related to the specified taxId. This value relates to the CompanyCode
set in the SBDH.page integer No 1 To specify the page to be returned, set the value between 1 and 10. perPage integer No 10 To specify the number of results for the returned page, set its value between 1 and 100.
Important:If the attachment file is configured to return the binary content, instead of a link, it's recommended to use only values between 1 and 10.
sourceSystemId string Yes Set it to include only notifications related to documents that originate from the given source system. This value is related to the SenderSystemId in the SBDH. includeAcknowledged boolean No false Set it to "true" to specify whether previously acknowledged notifications must be included in the result. includeBinaryData boolean No false Set it to "true" to include the binary data of the XML and PDF in the application response. processType string No Set it to "0" to only include notifications related to outbound documents. - Request Sample
-
curl --location --request GET 'https://api-test.sovos.com/v1/notifications/MX?page=1&perPage=2&includeAcknowledged=true&taxId={taxId}&sourceSystemId={sourceSystemId}&includeBinaryData=true&processType=0' \ --header 'Content-Type: application/json' \ --header 'x-correlationId: 057b5a5e-520c-4ea0-a948-9d583b4d121c' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx'
- Response Sample
-
{ "timestamp": 1633687728708, "status": 200, "success": true, "message": "Notifications Listed", "data": { "pageState": { "page": 1, "perPage": 2, "totalPages": 140, "totalEntries": 1399 }, "notifications": [ { "createdDate": 1629824492, "metadata": { "productId": "CFDI", "documentId": "3428ba6600dfd042a2090390e04471ed16b1", "erpDocumentId": "80257087", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "101", "sciResponseCode": "IP", "sciStatusAction": "NOA" }, "appPrefix": "INV", "notificationId": "da3095da-f974-420c-bce2-e33682692276", "content": "PEF...c2U+" }, { "createdDate": 1629857132, "metadata": { "productId": "CFDI", "documentId": "3b20cf820153a0407f0b40402482b216cd7b", "erpDocumentId": "321412", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "102", "sciResponseCode": "IP", "sciStatusAction": "NOA" }, "appPrefix": "INV", "notificationId": "6b0e273b-9ba9-43bc-9911-7eea7867786e", "content": "PEF...NlPg==" } ] } }
- GET /documents/MX/{documentId}/notifications
-
The supplier can send a
GET
request to the /documents/MX/{documentId}/notifications endpoint to retrieve application responses related to a single document.To make this request, set the following parameters:
Name Type Required Parameter type Default Description documentId string Yes Path Set it to the ID of the document returned in step 2. includeAcknowledged boolean No Query false Set it to "true" to specify whether previously acknowledged notifications must be included in the result. includeBinaryData boolean No Query false Set it to "true" to include the binary data of the XML and PDF in the application response. - Request Sample
-
curl --location --request GET 'https://api-test.sovos.com/v1/documents/MX/{documentId}/notifications?includeAcknowledged=true&includeBinaryData=true' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx' \ --header 'x-correlationId: 6d49dcfe-fd6b-4fb5-a590-44f4e720d70b'
- Response Sample
-
{ "timestamp": 1633685509314, "status": 200, "success": true, "message": "Notifications Listed", "data": { "pageState": { "page": 1, "perPage": 50, "totalEntries": 1 }, "notifications": [ { "createdDate": 1633681296, "metadata": { "productId": "CFDI", "documentId": "0af1d17c-759a-4b93-b6f5-ad11601be390", "erpDocumentId": "76059264", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "200", "sciResponseCode": "AP", "sciStatusAction": "NOA", "sciGovtStatusCode": "100" }, "appPrefix": "INV", "notificationId": "a8dc1aa2-fbe6-45ce-9e4c-97a3d5fdb91c", "content": "PEF...NlPg==" } ] } }
Step 12: Supplier Marks the Application Responses as Acknowledged
After retrieving application responses, the supplier must process them and mark them as acknowledged. This can be done by sending a PUT
request to the /notifications/MX endpoint.
To make this request, set the following request body parameters:
Name | Type | Required | Description |
---|---|---|---|
status | string | Yes | Set it to "read". |
notificationId | string | Yes | Set it to the ID of the notification that must be marked as acknowledged. |
Multiple notificationId values can be acknowledged using one COAPI call by including them in a single request.
- Request Sample
-
curl --location --request PUT 'https://api-test.sovos.com/v1/notifications/MX' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx' \ --header 'x-correlationId: 057b5a5e-520c-4ea0-a948-9d583b4d121c' \ --data-raw '[ { "status": "read", "notificationId": "51341d39-fd3e-4dcf-aea3-a73d73e0de76" } ]'
- Response Sample
-
{ "timestamp": 1601673284, "status": 200, "success": true, "message": "Notifications acknowledged successfully." }
Supplier sends the CFDI and the PDF to the Buyer
As the final step, the supplier should send the CFDI XML and optionally the PDF to the buyer through an agreed-upon channel. This process is outside the scope of Sovos.
Error handling
Customers need to adhere to the error handling principles outlined on the responses page.
In general, all error codes in the 400 range are client errors, so the customer needs to analyze them. After fixing the error, it's possible to resend the request. Error codes 408 and 429 are exceptions: in these cases, customers should wait at least 60 seconds before retrying. The error codes in the 500 range are server errors. In that case, customers need to resend the request, according to the instructions given on the responses page, which also includes a full list of error codes the COAPI can return.
Errors coming from the Mexican Tax Authority will be shown in the application response. This means that, in the case of a rejection, the SCIResponseCode will be set to "RE" and any error codes coming from the Tax Authority will be shown in the SCIGovtStatusCode element. The customer is responsible for taking action upon receiving an error code and a message from the Tax Authority. This Mexican government web page contains all the error codes the Mexican tax authority can return, including a description and resolution, and can be used for error handling.
The following section describes a unique case that must be taken into consideration.
- Duplicate Invoices
- When a duplicate Mexican invoice is sent to Sovos, it's treated as a unique invoice and goes through the same process as explained in the flowchart. At step 7, when it reaches the PCCFDI, it responds with the exact same response as when the original transaction was sent, so it will NOT indicate that the transaction is a duplicate. This means that the same five application responses will be generated and can be retrieved by the customer, so they're responsible for avoiding or managing the process of sending duplicate invoices.
Cancel invoice
The following diagram provides a detailed overview of the invoice cancellation process in Mexico:
Step 1: Supplier sends the POST request to Sovos
The supplier sends a POST request to the /documents/MX/action endpoint.
Request body parameters:
Name | Type | Required | Description |
---|---|---|---|
actionCode | string | Yes | Always set it to "document.cancellation". |
documents | array of objects | Yes | An array of objects to include the metadata and the document ID. |
metadata | object | No | An object that includes the reason metadata. |
reason | string | No | This field must be used to provide the reason for cancelling the invoice. For the SAT cancellation codes, refer to this government web page. |
documentId | string | Yes | The ID of the document to be cancelled. This is the documentId , as returned by Sovos upon sending the document. |
- Request Sample
-
curl --location --request POST 'https://api-test.sovos.com/v1/documents/MX/action' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx' \ --header 'x-correlationId: 057b5a5e-520c-4ea0-a948-9d583b4d121c' \ --data-raw ' { "actionCode": "document.cancellation", "documents": [ { "metadata": { "reason": "{reason}", "documentReferenceID": "{documentReferenceID}" }, "documentId": "{documentId}" } ] }'
- Response Sample
-
{ "timestamp": 1605632952347, "status": 202, "success": true, "message": "Action Received", "data": [ { "documentId": "62b6c12e08264046960a35e00b5ed9d11d97" } ] }
Step 2: Sovos extracts the Folio
Sovos extracts the folio number from the invoice to be canceled, as this information is required for the cancellation request.
Step 3: Sovos transmits the Cancellation
Sovos transmits the cancellation request to the PCCFDI.
Step 4: PCCFDI performs the Validation
The PCCFDI validates the cancellation request to see whether the invoice has been cleared.
Step 5: PCCFDI transmits the Cancellation
After performing the validation, the PCCFDI transmits the cancellation request to the SAT.
Step 6: SAT processes the Cancellation
The SAT processes the cancellation request. In the majority of cases, the SAT must request authorization from the buyer before it can confirm the cancellation. This means that the SAT initiates pre-cancellation, which is essentially an intermediary state that must await acceptance or rejection from the buyer before it may progress to the final state. The buyer has 72 business hours to accept or reject the cancellation. After that, the acceptance becomes implicit.
Step 7: SAT returns the Response
The acceptance or rejection message is then returned to Sovos through the PCCFDI.
Step 8: Supplier retrieves the Application Responses
It is highly recommended that clients configure their Application Response attachments as download links instead of base64 encoded data to avoid potential size limitations when retrieving responses. The default option is download links.
-
When using "download links" the response contains a URL from where the file can be downloaded.
-
When using "binary data", the file itself is embedded in the response encoded in base64.
This configuration is available through our Professional Services team.
As a response to the initial sending of the document, the client will receive a JSON response message with an HTTP status code of 202 (asynchronous transaction). This means that the supplier must retrieve the application responses that become available during the transaction, which provide status information and will also include the acceptance or rejection message.
To complete a transaction, the supplier must retrieve application responses until the SCIResponseCode in the response has the value of either "AP" or "RE", which indicates that the transaction is finished.
The supplier can use the following COAPI endpoints to retrieve application responses:
- GET /notifications/MX
-
The supplier can send a
GET
request to the /notifications/MX endpoint to retrieve application responses that match the set search criteria. This endpoint allows setting the following query parameters:Name Type Required Default Description taxId string No Set it to include only notifications related to the specified taxId. This value relates to the CompanyCode set in the SBDH. page integer No 1 To specify the page to be returned, set the value between 1 and 10. perPage integer No 10 To specify the number of results for the returned page, set its value between 1 and 100.
Important:If the attachment file is configured to return the binary content, instead of a link, it's recommended to use only values between 1 and 10.
sourceSystemId string Yes Set it to include only notifications related to documents that originate from the given source system. This value is related to the SenderSystemId in the SBDH. includeAcknowledged boolean No false Set it to "true" to specify whether previously acknowledged notifications must be included in the result. includeBinaryData boolean No false Set it to "true" to include the binary data of the XML and PDF in the application response. processType string No Set it to "0" to only include notifications related to outbound documents. - Request Sample
-
curl --location --request GET 'https://api-test.sovos.com/v1/notifications/MX?page=1&perPage=2&includeAcknowledged=true&taxId={taxId}&sourceSystemId={sourceSystemId}&includeBinaryData=true&processType=0' \ --header 'Content-Type: application/json' \ --header 'x-correlationId: 057b5a5e-520c-4ea0-a948-9d583b4d121c' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx'
- Response Sample
-
{ "timestamp": 1633687728708, "status": 200, "success": true, "message": "Notifications Listed", "data": { "pageState": { "page": 1, "perPage": 2, "totalPages": 140, "totalEntries": 1399 }, "notifications": [ { "createdDate": 1629824492, "metadata": { "productId": "FE", "documentId": "3428ba6600dfd042a2090390e04471ed16b1", "erpDocumentId": "80257087", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "101", "sciResponseCode": "IP", "sciStatusAction": "NOA" }, "appPrefix": "INV", "notificationId": "da3095da-f974-420c-bce2-e33682692276", "content": "PEF...c2U+" }, { "createdDate": 1629857132, "metadata": { "productId": "FE", "documentId": "3b20cf820153a0407f0b40402482b216cd7b", "erpDocumentId": "321412", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "102", "sciResponseCode": "IP", "sciStatusAction": "NOA" }, "appPrefix": "INV", "notificationId": "6b0e273b-9ba9-43bc-9911-7eea7867786e", "content": "PEF...NlPg==" } ] } }
- GET /documents/MX/{documentId}/notifications
- The supplier can send a
GET
request to the /documents/MX/{documentId}/notifications endpoint to retrieve application responses related to a single document.To make this request, set the following parameters:
Name Type Required Parameter type Default Description documentId string Yes Path Set it to the ID of the document returned in step 1. includeAcknowledged boolean No Query false Set it to "true" to specify whether previously acknowledged notifications must be included in the result. includeBinaryData boolean No Query false Set it to "true" to include the binary data of the XML and PDF in the application response. - Request Sample
-
curl --location --request GET 'https://api-test.sovos.com/v1/documents/MX/{documentId}/notifications?includeAcknowledged=true&includeBinaryData=true' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx' \ --header 'x-correlationId: 6d49dcfe-fd6b-4fb5-a590-44f4e720d70b'
- Response Sample
-
{ "timestamp": 1633685509314, "status": 200, "success": true, "message": "Notifications Listed", "data": { "pageState": { "page": 1, "perPage": 50, "totalEntries": 1 }, "notifications": [ { "createdDate": 1633681296, "metadata": { "productId": "CFDI", "documentId": "0af1d17c-759a-4b93-b6f5-ad11601be390", "erpDocumentId": "76059264", "erpSystemId": "uat_test", "processType": "0", "taxId": "URE180429TM6", "sciCloudStatusCode": "200", "sciResponseCode": "AP", "sciStatusAction": "NOA", "sciGovtStatusCode": "100" }, "appPrefix": "INV", "notificationId": "a8dc1aa2-fbe6-45ce-9e4c-97a3d5fdb91c", "content": "PEF...NlPg==" } ] } }
Step 9: Supplier marks the Application Responses as Acknowledged
After retrieving application responses, the supplier must process them and mark them as acknowledged. This can be done by sending a PUT
request to the /notifications/MX endpoint.
Request body parameters:
Name | Type | Required | Description |
---|---|---|---|
status | string | Yes | Set it to "read". |
notificationId | string | Yes | Set it to the ID of the notification that should be marked as acknowledged. |
- Request Sample
-
curl --location --request PUT 'https://api-test.sovos.com/v1/notifications/MX' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer oj3Uw1IJLVZyrc8TYmC9amh7F5Cx' \ --header 'x-correlationId: 6d49dcfe-fd6b-4fb5-a590-44f4e720d70b' --data-raw '[ { "status": "read", "notificationId": "51341d39-fd3e-4dcf-aea3-a73d73e0de76" } ]'
- Response Sample
-
{ "timestamp": 1601673284, "status": 200, "success": true, "message": "Notifications acknowledged successfully." }
Error handling
Customers need to adhere to the error handling principles outlined on the responses page.
In general, all error codes in the 400 range are client errors, so the customer needs to analyze them. After fixing the error, it's possible to resend the request. Error codes 408 and 429 are exceptions: in these cases, customers should wait at least 60 seconds before retrying. The error codes in the 500 range are server errors. In that case, customers need to resend the request, according to the instructions given on the responses page, which also includes a full list of error codes the COAPI can return.
Errors coming from the Mexican Tax Authority will be shown in the application response. This means that, in the case of a rejection, the SCIResponseCode will be set to "RE" and any error codes coming from the Tax Authority will be shown in the SCIGovtStatusCode element. The customer is responsible for taking action upon receiving an error code and a message from the Tax Authority. This Mexican government web page contains all the error codes the Mexican tax authority can return, including a description and resolution, and can be used for error handling.
Consultations
The following diagram gives a detailed overview of the process for Consultations in Mexico based on the Default business process:
Step 1: Sender creates Standard Business Document
Every invoice sent to Sovos must be part of a Standard Business Document (SBD). This document includes a Standard Business Document Header (SBDH) and a Sovos Document node, which in turn includes a Sovos Canonical Invoice (SCI). To create the SBD, follow the detailed instructions in the SBDH, Sovos Document, and SCI pages. In addition, we'll now take a closer look at some key elements within the SBD:
- SCI - Invoice
-
Node Required Attributes Value StandardBusinessDocumentHeader.Sender.Identifier Yes Authority="MX" Supplier's RFC StandardBusinessDocumentHeader.Receiver.Identifier Yes Authority="MX" StandardBusinessDocumentHeader.DocumentIdentification.Standard Yes urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 StandardBusinessDocumentHeader.DocumentIdentification.TypeVersion Yes 2.1 StandardBusinessDocumentHeader.DocumentIdentification.Type Yes Invoice StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Country
Child node Identifier: MX
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: ProcessType
Child node Identifier: Outbound
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: SenderDocumentId
Child node Identifier: A unique document ID
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: SenderSystemId
Child node Identifier: The system ID configured in the backend.
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: CompanyCode
Child node Identifier: Supplier's RFC
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No Child node Type: BusinessCategory
Child node Identifier: BusinessToBusiness or BusinessToConsumer. The default mode is BusinessToBusiness when this node is omitted, so if the transaction is business to consumer this must be explicitly specified.
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Mapping.OutputSchema
Child node Identifier: Comprobante
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes Child node Type: Mapping.TransformDocument
Child node Identifier: SCI-TO-LEGAL_INVOICE
StandardBusinessDocumentHeader.BusinessScope.Scope.BusinessService.BusinessServiceName Yes Default SovosDocument.SovosCanonicalInvoice.Invoice Yes SCI - Local Format - Invoice
- Alternatively, the supplier can use the local format (XML) instead of SCI.
To do this, the SBD must be created with the following differences compared to when using the SCI:
Node Required Value StandardBusinessDocumentHeader.DocumentIdentification.Standard Yes http://www.sat.gob.mx/cfd/3 StandardBusinessDocumentHeader.DocumentIdentification.TypeVersion Yes 3.3 StandardBusinessDocumentHeader.DocumentIdentification.Type Yes Comprobante StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No (never use) Child node Type: Mapping.OutputSchema StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No (never use) Child node Type: Mapping.TransformDocument SovosDocument.SovosLegalDocument Yes The CFDI invoice
It's important to include all the mandatory nodes as specified in the SBDH schema. In case the information cannot be provided, and the respective mandatory node has not been mentioned on the current page, for example the receiver.identifier, the node can be left empty but must still be included in the SBDH.
- SBD Sample
-
<?xml version="1.0" encoding="UTF-8"?> <sbd:StandardBusinessDocument xmlns:sbd="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:svs="http://www.sovos.com/namespaces/sovosDocument" xmlns:ad="http://www.sovos.com/namespaces/additionalData" xmlns:sov="http://www.sovos.com/namespaces/sovosExtensions" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"> <sbd:StandardBusinessDocumentHeader> <sbd:HeaderVersion>1.0</sbd:HeaderVersion> <sbd:Sender> <sbd:Identifier Authority="MX">FUNK671228PH6</sbd:Identifier> </sbd:Sender> <sbd:BusinessScope> <sbd:Scope> <sbd:Type>Country</sbd:Type> <sbd:InstanceIdentifier/> <sbd:Identifier>MX</sbd:Identifier> </sbd:Scope> </sbd:BusinessScope> </sbd:StandardBusinessDocumentHeader> <svs:SovosDocument> <svs:SovosLegalDocument> <svs:LegalSchema> <cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3"> *Legal Document Content* </cfdi:Comprobante> </svs:LegalSchema> </svs:SovosLegalDocument> </svs:SovosDocument> </sbd:StandardBusinessDocument>
Step 2: Sender sends SBD to Sovos
The customer sends a POST
request to the /consultations endpoint.
To make this request, set the following request body parameters:
Name | Type | Required | Description |
---|---|---|---|
consultationCode | string | Yes | Set it to "document.validation" to make a validation on the CFDI. |
Productid | string | Yes | Set it to "MX_BusinessToBusiness_Consultations_V1.0". |
documents | array of objects | No | |
documentData | string | No | Enter the SBD and the document encoded in base64. |
dataEncoding | string | No | Set it to base64. |
- Request Sample
-
curl --location --request POST 'https://api-test-tls.sovos.com/v1/consultations' \ --header 'x-correlationId: SET-TO-UNIQUE-VALUE' \ --header 'Authorization: Bearer TOKEN' \ --header 'Content-Type: application/json' \ --data-raw '{ "consultationCode": "document.validation", "productId": "MX_BusinessToBusiness_Consultations_V1.0", "documents": [ { "metadata": { "trackId": "test" }, "dataEncoding": "base64", "data": "PD94...bnQ+" } ] }'
- Response Sample
- Here's a response sample with no errors in the validation:
{ "status": 202, "message": "Document received", "timestamp": 1676052321871, "data": { "completed": true, "nextPollInSeconds": 0, "jobState": null, "detailsDto": { "completed": "DONE", "messages": [ { "code": "200", "message": "Document verified successfully" } ], "documents": [], "keys": [ { "key": "LegalCleared", "value": "http://qa2.reachcore.io/Portal/Documentos?x=eisPj82nX0gKSClnl8GI3JFRZMPINRn3ieMNGcBC6%252F0dlRpPmVSvFZFGG8PTlmNDivXjFH6h61%252Ba86mfEeSghxhJGs3V2qaUjBbmgC%252B44EB9fYUkJmLf1Trt9pijwZZEsZeXdCB8x6%252BZASRKoNcdJ1wN90av6swu0rev3aXWr4BP2CiDWPf2qHDDcSeGdJSUYaLJHhpfGafKyphdKxSk7vRSu6eFLpuvAjU0s6lOhjRmJqvYGSDaLA%253D%253D" }, { "key": "PDF", "value": "http://qa2.reachcore.io/Portal/Documentos?x=eisPj82nX0gKSClnl8GI3JFRZMPINRn3ieMNGcBC6%252F0dlRpPmVSvFZFGG8PTlmNDivXjFH6h61%252Ba86mfEeSghxhJGs3V2qaUjBbmgC%252B44EB9fYUkJmLf1Trt9pijwZZEeWBDpJVeN8A4yoIXpMxRg7zr%252F9sj5WDfGdoKrThOnp%252BZ6AgL0P1NeBa9MVVGERswT9Gv7SxS735la%252B%252FAudi8PHNrlFsJiYw16MBnBJ9MAm63Cl2vJKBRSA%253D%253D" }, { "key": "UUID", "value": "C516576A-B230-4E50-BE9F-15F06CF9D9A8" } ], "errors": [] } }, "success": true }
Here's a response sample with errors in the validation:
{ "status": 202, "message": "Document received", "timestamp": 1676051628945, "data": { "completed": true, "nextPollInSeconds": 0, "jobState": null, "detailsDto": { "completed": "DONE", "messages": [ { "code": "400", "message": "Errors were found while performing validation" } ], "documents": [], "keys": [], "errors": [ { "code": "CF-CFDI-0003", "message": "No se encontró el elemento timbre fiscal digital en el nodo Complemento del comprobante" }, { "code": "CF-CFDI-0014", "message": "No existe el TFD." }, { "code": "CF-CFDI-0015", "message": "El atributo 'Sello' del comprobante, es diferente al atributo 'SelloCFD' que se encuentra en el complemento timbre Fiscal." }, { "code": "203", "message": "No se encontró el nodo TimbreFiscalDigital'." } ] } }, "success": true }
Step 3: Sovos identifies the consultation
Sovos receives and identifies the requested consultation type. Sovos proceeds to forward it to the PCCFDI.
Step 4: Sovos processes the request with the PCCFDI.
Sovos properly routes the consultation request to the corresponding PCCFDI service.
Step 5: The PCCFDI sends a response
The PCCFDI processes the Consultation request and returns the response to Sovos.
Step 6: Sovos returns the response to the Customer.
Sovos communicates the PCCFDI's response to the Sender.
Tax ID check
The diagram below provides a detailed overview of the process for Tax ID Checks in Mexico based on the Default business process:
Step 1: Requester sends a Tax ID verification request
The requester sends a POST
request to the /taxid-checks/MX
endpoint.
To make this request, set the following request body parameters:
Name | Type | Required | Description |
---|---|---|---|
taxId | string | No | Set it to the tax ID that should be validated. |
countryCode | string | No | Set it to "MX". |
requester | object | No | An object that holds the requester's details. |
taxId | string | No | Set it to the requester's tax ID. |
- Request Sample
-
curl --location --request POST 'https://api-test-tls.sovos.com/v1/taxid-checks/MX' \ --header 'x-correlationId: SET-TO-UNIQUE-VALUE' \ --header 'Authorization: Bearer TOKEN' \ --header 'Content-Type: application/json' \ --data-raw '{ "taxId": "XIA190128J61", "countryCode": "MX", "requester": { "taxId": "AAB1011024L8" } }'
- Response Sample
-
{ "status": 202, "message": "success", "timestamp": 1676638006079, "data": { "taxId": "AAB1011024L8", "legalName": "ASESORES ADMINISTRATIVOS BAIK S.A. DE C.V.", "additionalData": { "queryDate": "2023-02-17T06:46:45", "found": "Si", "statusTaxIds": [ { "statusKey": "situacion", "statusValue": "Definitivo" }, { "statusKey": "noOficioPresuncion", "statusValue": "500-05-2014-16093 de fecha 30 de abril de 2014" }, { "statusKey": "fechaSATPresuncion", "statusValue": "2014-05-01T00:00:00" }, { "statusKey": "fechaDOFPresuncion", "statusValue": "2014-05-15T00:00:00" }, { "statusKey": "fechaDOFDefinitivos", "statusValue": "2015-03-16T00:00:00" }, { "statusKey": "noOficioSentenciaFavorable", "statusValue": "500-05-2015-7905 de fecha 16 de marzo de 2015?" }, { "statusKey": "fechaSATSentenciaFavorable", "statusValue": "2015-04-06T00:00:00" } ] } }, "success": true }
Step 2: Sovos transmits the request to the PCCFDI
Sovos receives and identifies the request, then forwards it to the PCCFDI.
Step 3: PCCFDI performs the validation
The PCCCFDI performs the validation of the tax ID against the list 69B (blocklist).
Step 4: Sovos returns the response to the requester
Sovos communicates the PCCFDI's response to the Requester.