Skip to main content
Key: mx-cfdi-v4

Scenarios

Scenarios attach notes and extensions to a document when its filters match. Read more about scenarios.
TagsTypeOutput
-standard{
  “ext”: {
    “mx-cfdi-doc-type”: “I”
  }
}
-credit-note{
  “ext”: {
    “mx-cfdi-doc-type”: “E”,
    “mx-cfdi-rel-type”: “01”
  }
}
customstandard
credit-note
{
  “ext”: {
    “mx-cfdi-payment-method”: “PUE”
  }
}
customstandard
credit-note
{
  “ext”: {
    “mx-cfdi-payment-method”: “PPD”
  }
}

Extensions

Document Type

CodeName
IInvoice
ECredit Note

Relation Type

CodeName
01Credit note for related documents
02Debit note for related documents
03Return of goods for related documents
04Substitution of the previous CFDI document
05Transfer of goods for related documents
06Invoice generated by previous transfers
07CFDI for advance payment

Place of Issue

Post code of where the invoice was issued. In CFDI, this translates to the ‘LugarExpedicion’.
Pattern: ^[0-9]{5}$

Tax Type

Code defined in the CFDI catalogue “c_Impuesto” for the type of tax. Used in the ‘Impuesto’ field.
CodeName
001Income Tax
002Value Added Tax
003Special 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.

Fiscal Regime Code

Fiscal regime associated with suppliers and customers.
CodeName
601General de Ley Personas Morales
603Personas Morales con Fines no Lucrativos
605Sueldos y Salarios e Ingresos Asimilados a Salarios
606Arrendamiento
607Régimen de Enajenación o Adquisición de Bienes
608Demás ingresos
610Residentes en el Extranjero sin Establecimiento Permanente en México
611Ingresos por Dividendos (socios y accionistas)
612Personas Físicas con Actividades Empresariales y Profesionales
614Ingresos por intereses
615Régimen de los ingresos por obtención de premios
616Sin obligaciones fiscales
620Sociedades Cooperativas de Producción que optan por diferir sus ingresos
621Incorporación Fiscal
622Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras
623Opcional para Grupos de Sociedades
624Coordinados
625Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas
626Régimen Simplificado de Confianza

CFDI Use Code

Chosen by the customer to indicate the purpose of an invoice.
CodeName
G01Acquisition of goods
G02Returns, discounts or rebates
G03General expenses
I01Construction
I02Office furniture and equipment as investmen
I03Transport equipment
I04Computer equipment and accessories
I05Dies, punches, molds, matrices and other toolin
I06Telephone communications
I07Satellite communications
I08Other machinery and equipment
D01Medical and dental fees and hospital expenses
D02Medical expenses for disability or incapacity
D03Funeral expenses
D04Donations
D05Interest actually paid on mortgage loans (housing)
D06Voluntary contributions to the SAR
D07Medical insurance premiums
D08Mandatory school transportation expenses
D09Deposits in savings accounts, pension plans premiums
D10Payments for educational services (school fees)
S01Without tax effects
CP01Payments
CN01Payroll

Payment Method

Code defined in the CFDI catalogue “c_MetodoPago” for the payment method. Used in the ‘MetodoPago’ field.
CodeName
PUEPayment in a single exhibition
PPDPayment in deferred installments

Payment Means

Code defined in the CFDI catalogue “c_FormaPago” for the payment method. Used in the ‘FormaPago’ field.
CodeName
01Cash
02Check
03Electronic Funds Transfer
04Credit Card
05Electronic Wallet
06Online or Electronic Payment
08Grocery Voucher
12Payment in Kind
13Payment by subrogation
14Payment by consignment
15Debt relief
17Netting
23Novation
24Merger
25Debt remission
26Expiration of payment obligation
27To the creditor’s satisfaction
28Debit card
29Services card
30Advance payment
31Payment via intermediary
99Undefined

CFDI Global Period

Period for when the sales where generated.
CodeName
01Daily
02Weekly
03Biweekly
04Monthly
05Bimonthly

CFDI Global Month

Specific month or month range for the global invoice.
CodeName
01January
02February
03March
04April
05May
06June
07July
08August
09September
10October
11November
12December
13January-February
14March-April
15May-June
16July-August
17September-October
18November-December

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.
FieldTestValidation Code / Message
tax.ext
  • Ext require [mx-cfdi-doc-type, mx-cfdi-issue-place, mx-cfdi-payment-method]
GOBL-MX-CFDI-V4-BILL-INVOICE-01
Tax requires ‘mx-cfdi-doc-type’, ‘mx-cfdi-issue-place’, and ‘mx-cfdi-payment-method’ extensions
tax.ext
  • Has global tag
  • Ext require [mx-cfdi-global-period, mx-cfdi-global-month, mx-cfdi-global-year]
GOBL-MX-CFDI-V4-BILL-INVOICE-02
Global invoices require ‘mx-cfdi-global-period’, ‘mx-cfdi-global-month’, and ‘mx-cfdi-global-year’ extensions
customer
  • Has global tag
  • Empty
GOBL-MX-CFDI-V4-BILL-INVOICE-03
Cannot be set with global tag
payment
  • Has global tag
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-04
Payment is required for global invoices
payment.advances
  • Has global tag
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-05
Advances must be set with global tag
lines[*].item.ref
  • Has global tag
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-06
Must be set with global tag
tax.ext
  • No global tag
  • Ext require all or none of [mx-cfdi-global-period, mx-cfdi-global-month, mx-cfdi-global-year]
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
  • No global tag
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-08
Customer tax ID is required
customer.tax_id.code
  • No global tag
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-09
Customer tax ID code is required
customer.ext
  • Customer is Mexican
  • Ext require [mx-cfdi-fiscal-regime, mx-cfdi-use]
GOBL-MX-CFDI-V4-BILL-INVOICE-10
Mexican customer requires ‘mx-cfdi-fiscal-regime’ and ‘mx-cfdi-use’ extensions
customer.addresses
  • Customer is Mexican
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-11
Mexican customer must have at least one address
customer.addresses[*].code
  • Customer is Mexican
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-12
Customer address postal code is required
customer.addresses[*].code
  • Customer is Mexican
  • Matches ^[0-9]$
GOBL-MX-CFDI-V4-BILL-INVOICE-13
Customer address postal code format is invalid
lines[*].item.ext
  • No global tag
  • Ext require [mx-cfdi-prod-serv]
GOBL-MX-CFDI-V4-BILL-INVOICE-14
Item requires ‘mx-cfdi-prod-serv’ extension
lines[*].item.ext
  • No global tag
  • Valid prod-serv
GOBL-MX-CFDI-V4-BILL-INVOICE-15
Product/service code must have 8 digits
tax.ext
  • Has preceding
  • Ext require [mx-cfdi-rel-type]
GOBL-MX-CFDI-V4-BILL-INVOICE-16
Tax requires ‘mx-cfdi-rel-type’ extension when preceding documents are present
preceding[*].stamps
  • Stamps have sat-uuid
GOBL-MX-CFDI-V4-BILL-INVOICE-17
Preceding row is missing ‘sat-uuid’ stamp
supplier.tax_id
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-18
Supplier tax ID is required
supplier.tax_id.code
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-19
Supplier tax ID code is required
supplier.ext
  • Ext require [mx-cfdi-fiscal-regime]
GOBL-MX-CFDI-V4-BILL-INVOICE-20
Supplier requires ‘mx-cfdi-fiscal-regime’ extension
lines[*].quantity
  • Min 0
GOBL-MX-CFDI-V4-BILL-INVOICE-21
Line quantity must be greater than 0
lines[*].item.price
  • Present
GOBL-MX-CFDI-V4-BILL-INVOICE-22
Line item price is required
lines[*].item.price
  • Min 0
GOBL-MX-CFDI-V4-BILL-INVOICE-23
Line item price must be greater than 0
lines[*].total
  • Min 0
GOBL-MX-CFDI-V4-BILL-INVOICE-24
Line total must not be negative
discounts
  • Empty
GOBL-MX-CFDI-V4-BILL-INVOICE-25
Document level discounts are not supported, use line discounts instead
charges
  • Empty
GOBL-MX-CFDI-V4-BILL-INVOICE-26
Document level charges are not supported
FieldTestValidation Code / Message
ext
  • Ext require [mx-cfdi-payment-means]
GOBL-MX-CFDI-V4-PAY-INSTRUCTIONS-01
Payment instructions require ‘mx-cfdi-payment-means’ extension
FieldTestValidation Code / Message
ext
  • Ext require [mx-cfdi-payment-means]
GOBL-MX-CFDI-V4-PAY-ADVANCE-01
Payment advance requires ‘mx-cfdi-payment-means’ extension
FieldTestValidation Code / Message
notes
  • Length between 0 and 1000
GOBL-MX-CFDI-V4-PAY-TERMS-01
Notes length must be no more than 1000
FieldTestValidation Code / Message
employer_registration
  • Length between 0 and 20
GOBL-MX-CFDI-V4-FOODVOUCHERS-01
Employer registration must be no more than 20 characters
account_number
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-02
Account number is required
account_number
  • Length between 0 and 20
GOBL-MX-CFDI-V4-FOODVOUCHERS-03
Account number must be no more than 20 characters
total
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-04
Total is required
lines
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-05
Lines are required
lines[*].e_wallet_id
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-06
Line e-wallet ID is required
lines[*].e_wallet_id
  • Length between 0 and 20
GOBL-MX-CFDI-V4-FOODVOUCHERS-07
Line e-wallet ID must be no more than 20 characters
lines[*].issue_date_time
  • Not zero
GOBL-MX-CFDI-V4-FOODVOUCHERS-08
Line issue date and time is required
lines[*].employee
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-09
Line employee is required
lines[*].employee.tax_code
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-10
Employee tax code (RFC) is required
lines[*].employee.tax_code
  • Valid RFC
GOBL-MX-CFDI-V4-FOODVOUCHERS-11
Employee tax code (RFC) must be valid
lines[*].employee.curp
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-12
Employee CURP is required
lines[*].employee.curp
  • Matches ^[A-Z][A,E,I,O,U,X][A-Z][0-9][0-1][0-9][0-3][0-9][M,H][A-Z][B,C,D,F,G,H,J,K,L,M,N,Ñ,P,Q,R,S,T,V,W,X,Y,Z][0-9,A-Z][0-9]$
GOBL-MX-CFDI-V4-FOODVOUCHERS-13
Employee CURP format must be valid
lines[*].employee.name
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-14
Employee name is required
lines[*].employee.name
  • Length between 0 and 100
GOBL-MX-CFDI-V4-FOODVOUCHERS-15
Employee name must be no more than 100 characters
lines[*].employee.social_security
  • Matches ^[0-9]$
GOBL-MX-CFDI-V4-FOODVOUCHERS-16
Employee social security number format is invalid
lines[*].amount
  • Present
GOBL-MX-CFDI-V4-FOODVOUCHERS-17
Line amount is required
FieldTestValidation Code / Message
account_number
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-01
Account number is required
account_number
  • Length between 1 and 50
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-02
Account number must be between 1 and 50 characters
subtotal
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-03
Subtotal is required
total
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-04
Total is required
lines
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-05
Lines are required
lines[*]
  • Valid line total
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-20
Line total must be quantity x unit_price
lines[*].e_wallet_id
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-06
Line e-wallet ID is required
lines[*].purchase_date_time
  • Not zero
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-07
Line purchase date and time is required
lines[*].vendor_tax_code
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-08
Line vendor tax code is required
lines[*].vendor_tax_code
  • Valid RFC
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-09
Line vendor tax identity code is invalid
lines[*].service_station_code
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-10
Line service station code is required
lines[*].service_station_code
  • Length between 1 and 20
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-11
Line service station code must be between 1 and 20 characters
lines[*].quantity
  • Min 0
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-12
Line quantity must be greater than 0
lines[*].item
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-13
Line item is required
lines[*].item.type
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-14
Line item type is required
lines[*].item.name
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-15
Line item name is required
lines[*].item.name
  • Length between 1 and 300
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-16
Line item name must be between 1 and 300 characters
lines[*].item.price
  • Min 0
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-17
Line item price must be greater than 0
lines[*].purchase_code
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-18
Line purchase code is required
lines[*].purchase_code
  • Length between 1 and 50
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-19
Line purchase code must be between 1 and 50 characters
lines[*].taxes
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-21
Line taxes are required
lines[*].taxes[*].cat
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-22
Line tax category is required
lines[*].taxes[*].cat
  • One of [VAT, IEPS]
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-23
Line tax category must be a valid value
lines[*].taxes[*].rate
  • No percent
  • Present
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-24
Line tax rate is required when percent is not set
lines[*].taxes[*].rate
  • Min 0
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-25
Line tax rate must be greater than 0
lines[*].taxes[*].amount
  • Min 0
GOBL-MX-CFDI-V4-FUELACCOUNTBALANCE-26
Line tax amount must be greater than 0