mx-cfdi-v4
Scenarios
Scenarios attach notes and extensions to a document when its filters match. Read more about scenarios.Extensions
Document Type
mx-cfdi-doc-type
mx-cfdi-doc-type
| Code | Name |
|---|---|
I | Invoice |
E | Credit Note |
Relation Type
mx-cfdi-rel-type
mx-cfdi-rel-type
| Code | Name |
|---|---|
01 | Credit note for related documents |
02 | Debit note for related documents |
03 | Return of goods for related documents |
04 | Substitution of the previous CFDI document |
05 | Transfer of goods for related documents |
06 | Invoice generated by previous transfers |
07 | CFDI for advance payment |
Place of Issue
Post code of where the invoice was issued. In CFDI, this translates to the ‘LugarExpedicion’.mx-cfdi-issue-place
mx-cfdi-issue-place
Pattern:
^[0-9]{5}$Tax Type
Code defined in the CFDI catalogue “c_Impuesto” for the type of tax. Used in the ‘Impuesto’ field.mx-cfdi-tax-type
mx-cfdi-tax-type
| Code | Name |
|---|---|
001 | Income Tax |
002 | Value Added Tax |
003 | Special Tax on Production and Services |
Product or Service Code
Code defined in the CFDI catalogue used to identify a product or service. Mapped to the ‘ClaveProdServ’ CFDI field.mx-cfdi-prod-serv
mx-cfdi-prod-serv
Fiscal Regime Code
Fiscal regime associated with suppliers and customers.mx-cfdi-fiscal-regime
mx-cfdi-fiscal-regime
| Code | Name |
|---|---|
601 | General de Ley Personas Morales |
603 | Personas Morales con Fines no Lucrativos |
605 | Sueldos y Salarios e Ingresos Asimilados a Salarios |
606 | Arrendamiento |
607 | Régimen de Enajenación o Adquisición de Bienes |
608 | Demás ingresos |
610 | Residentes en el Extranjero sin Establecimiento Permanente en México |
611 | Ingresos por Dividendos (socios y accionistas) |
612 | Personas Físicas con Actividades Empresariales y Profesionales |
614 | Ingresos por intereses |
615 | Régimen de los ingresos por obtención de premios |
616 | Sin obligaciones fiscales |
620 | Sociedades Cooperativas de Producción que optan por diferir sus ingresos |
621 | Incorporación Fiscal |
622 | Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras |
623 | Opcional para Grupos de Sociedades |
624 | Coordinados |
625 | Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas |
626 | Régimen Simplificado de Confianza |
CFDI Use Code
Chosen by the customer to indicate the purpose of an invoice.mx-cfdi-use
mx-cfdi-use
| Code | Name |
|---|---|
G01 | Acquisition of goods |
G02 | Returns, discounts or rebates |
G03 | General expenses |
I01 | Construction |
I02 | Office furniture and equipment as investmen |
I03 | Transport equipment |
I04 | Computer equipment and accessories |
I05 | Dies, punches, molds, matrices and other toolin |
I06 | Telephone communications |
I07 | Satellite communications |
I08 | Other machinery and equipment |
D01 | Medical and dental fees and hospital expenses |
D02 | Medical expenses for disability or incapacity |
D03 | Funeral expenses |
D04 | Donations |
D05 | Interest actually paid on mortgage loans (housing) |
D06 | Voluntary contributions to the SAR |
D07 | Medical insurance premiums |
D08 | Mandatory school transportation expenses |
D09 | Deposits in savings accounts, pension plans premiums |
D10 | Payments for educational services (school fees) |
S01 | Without tax effects |
CP01 | Payments |
CN01 | Payroll |
Payment Method
Code defined in the CFDI catalogue “c_MetodoPago” for the payment method. Used in the ‘MetodoPago’ field.mx-cfdi-payment-method
mx-cfdi-payment-method
| Code | Name |
|---|---|
PUE | Payment in a single exhibition |
PPD | Payment in deferred installments |
Payment Means
Code defined in the CFDI catalogue “c_FormaPago” for the payment method. Used in the ‘FormaPago’ field.mx-cfdi-payment-means
mx-cfdi-payment-means
| Code | Name |
|---|---|
01 | Cash |
02 | Check |
03 | Electronic Funds Transfer |
04 | Credit Card |
05 | Electronic Wallet |
06 | Online or Electronic Payment |
08 | Grocery Voucher |
12 | Payment in Kind |
13 | Payment by subrogation |
14 | Payment by consignment |
15 | Debt relief |
17 | Netting |
23 | Novation |
24 | Merger |
25 | Debt remission |
26 | Expiration of payment obligation |
27 | To the creditor’s satisfaction |
28 | Debit card |
29 | Services card |
30 | Advance payment |
31 | Payment via intermediary |
99 | Undefined |
CFDI Global Period
Period for when the sales where generated.mx-cfdi-global-period
mx-cfdi-global-period
| Code | Name |
|---|---|
01 | Daily |
02 | Weekly |
03 | Biweekly |
04 | Monthly |
05 | Bimonthly |
CFDI Global Month
Specific month or month range for the global invoice.mx-cfdi-global-month
mx-cfdi-global-month
| Code | Name |
|---|---|
01 | January |
02 | February |
03 | March |
04 | April |
05 | May |
06 | June |
07 | July |
08 | August |
09 | September |
10 | October |
11 | November |
12 | December |
13 | January-February |
14 | March-April |
15 | May-June |
16 | July-August |
17 | September-October |
18 | November-December |
CFDI Global Year
mx-cfdi-global-year
mx-cfdi-global-year
Pattern:
\d{4}Validation Rules
Validation rules check each struct against a set of assertions and report any failures with a unique code and message. Read more about validation.bill.Invoice
bill.Invoice
| Field | Test | Validation Code / Message |
|---|---|---|
tax.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-01Tax requires ‘mx-cfdi-doc-type’, ‘mx-cfdi-issue-place’, and ‘mx-cfdi-payment-method’ extensions |
tax.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-02Global invoices require ‘mx-cfdi-global-period’, ‘mx-cfdi-global-month’, and ‘mx-cfdi-global-year’ extensions |
customer |
| GOBL-MX-CFDI-V4-BILL-INVOICE-03Cannot be set with global tag |
payment |
| GOBL-MX-CFDI-V4-BILL-INVOICE-04Payment is required for global invoices |
payment.advances |
| GOBL-MX-CFDI-V4-BILL-INVOICE-05Advances must be set with global tag |
lines[*].item.ref |
| GOBL-MX-CFDI-V4-BILL-INVOICE-06Must be set with global tag |
tax.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-07’mx-cfdi-global-period’, ‘mx-cfdi-global-month’, and ‘mx-cfdi-global-year’ extensions must all be present or all absent |
customer.tax_id |
| GOBL-MX-CFDI-V4-BILL-INVOICE-08Customer tax ID is required |
customer.tax_id.code |
| GOBL-MX-CFDI-V4-BILL-INVOICE-09Customer tax ID code is required |
customer.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-10Mexican customer requires ‘mx-cfdi-fiscal-regime’ and ‘mx-cfdi-use’ extensions |
customer.addresses |
| GOBL-MX-CFDI-V4-BILL-INVOICE-11Mexican customer must have at least one address |
customer.addresses[*].code |
| GOBL-MX-CFDI-V4-BILL-INVOICE-12Customer address postal code is required |
customer.addresses[*].code |
| GOBL-MX-CFDI-V4-BILL-INVOICE-13Customer address postal code format is invalid |
lines[*].item.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-14Item requires ‘mx-cfdi-prod-serv’ extension |
lines[*].item.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-15Product/service code must have 8 digits |
tax.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-16Tax requires ‘mx-cfdi-rel-type’ extension when preceding documents are present |
preceding[*].stamps |
| GOBL-MX-CFDI-V4-BILL-INVOICE-17Preceding row is missing ‘sat-uuid’ stamp |
supplier.tax_id |
| GOBL-MX-CFDI-V4-BILL-INVOICE-18Supplier tax ID is required |
supplier.tax_id.code |
| GOBL-MX-CFDI-V4-BILL-INVOICE-19Supplier tax ID code is required |
supplier.ext |
| GOBL-MX-CFDI-V4-BILL-INVOICE-20Supplier requires ‘mx-cfdi-fiscal-regime’ extension |
lines[*].quantity |
| GOBL-MX-CFDI-V4-BILL-INVOICE-21Line quantity must be greater than 0 |
lines[*].item.price |
| GOBL-MX-CFDI-V4-BILL-INVOICE-22Line item price is required |
lines[*].item.price |
| GOBL-MX-CFDI-V4-BILL-INVOICE-23Line item price must be greater than 0 |
lines[*].total |
| GOBL-MX-CFDI-V4-BILL-INVOICE-24Line total must not be negative |
discounts |
| GOBL-MX-CFDI-V4-BILL-INVOICE-25Document level discounts are not supported, use line discounts instead |
charges |
| GOBL-MX-CFDI-V4-BILL-INVOICE-26Document level charges are not supported |
pay.Instructions
pay.Instructions
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-MX-CFDI-V4-PAY-INSTRUCTIONS-01Payment instructions require ‘mx-cfdi-payment-means’ extension |
pay.Advance
pay.Advance
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-MX-CFDI-V4-PAY-ADVANCE-01Payment advance requires ‘mx-cfdi-payment-means’ extension |
pay.Terms
pay.Terms
| Field | Test | Validation Code / Message |
|---|---|---|
notes |
| GOBL-MX-CFDI-V4-PAY-TERMS-01Notes length must be no more than 1000 |
cfdi.FoodVouchers
cfdi.FoodVouchers
| Field | Test | Validation Code / Message |
|---|---|---|
employer_registration |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-01Employer registration must be no more than 20 characters |
account_number |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-02Account number is required |
account_number |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-03Account number must be no more than 20 characters |
total |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-04Total is required |
lines |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-05Lines are required |
lines[*].e_wallet_id |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-06Line e-wallet ID is required |
lines[*].e_wallet_id |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-07Line e-wallet ID must be no more than 20 characters |
lines[*].issue_date_time |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-08Line issue date and time is required |
lines[*].employee |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-09Line employee is required |
lines[*].employee.tax_code |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-10Employee tax code (RFC) is required |
lines[*].employee.tax_code |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-11Employee tax code (RFC) must be valid |
lines[*].employee.curp |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-12Employee CURP is required |
lines[*].employee.curp |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-13Employee CURP format must be valid |
lines[*].employee.name |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-14Employee name is required |
lines[*].employee.name |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-15Employee name must be no more than 100 characters |
lines[*].employee.social_security |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-16Employee social security number format is invalid |
lines[*].amount |
| GOBL-MX-CFDI-V4-FOODVOUCHERS-17Line amount is required |
cfdi.FuelAccountBalance
cfdi.FuelAccountBalance
| Field | Test | Validation Code / Message |
|---|---|---|
account_number |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-01Account number is required |
account_number |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-02Account number must be between 1 and 50 characters |
subtotal |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-03Subtotal is required |
total |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-04Total is required |
lines |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-05Lines are required |
lines[*] |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-20Line total must be quantity x unit_price |
lines[*].e_wallet_id |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-06Line e-wallet ID is required |
lines[*].purchase_date_time |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-07Line purchase date and time is required |
lines[*].vendor_tax_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-08Line vendor tax code is required |
lines[*].vendor_tax_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-09Line vendor tax identity code is invalid |
lines[*].service_station_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-10Line service station code is required |
lines[*].service_station_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-11Line service station code must be between 1 and 20 characters |
lines[*].quantity |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-12Line quantity must be greater than 0 |
lines[*].item |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-13Line item is required |
lines[*].item.type |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-14Line item type is required |
lines[*].item.name |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-15Line item name is required |
lines[*].item.name |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-16Line item name must be between 1 and 300 characters |
lines[*].item.price |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-17Line item price must be greater than 0 |
lines[*].purchase_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-18Line purchase code is required |
lines[*].purchase_code |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-19Line purchase code must be between 1 and 50 characters |
lines[*].taxes |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-21Line taxes are required |
lines[*].taxes[*].cat |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-22Line tax category is required |
lines[*].taxes[*].cat |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-23Line tax category must be a valid value |
lines[*].taxes[*].rate |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-24Line tax rate is required when percent is not set |
lines[*].taxes[*].rate |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-25Line tax rate must be greater than 0 |
lines[*].taxes[*].amount |
| GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-26Line tax amount must be greater than 0 |