> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gobl.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Mexican SAT CFDI v4.X

Key: `mx-cfdi-v4`

Module: [github.com/invopop/gobl.mx.cfdi](https://github.com/invopop/gobl.mx.cfdi)

## Scenarios

Scenarios attach notes and extensions to a document when its filters match.
[Read more about scenarios](https://docs.gobl.org/overview/scenarios.md).

> [accordion] bill/invoice
>
> | Tags | Type | Output |
> | - | - | - |
> | - | `standard` | `{  "ext": {    "mx-cfdi-doc-type": "I"  }}` |
> | - | `credit-note` | `{  "ext": {    "mx-cfdi-doc-type": "E",    "mx-cfdi-rel-type": "01"  }}` |
> | [custom](https://github.com/invopop/gobl.mx.cfdi/blob/v0.68.0/addon/scenarios.go#L32) | `standard` `credit-note` | `{  "ext": {    "mx-cfdi-payment-method": "PUE"  }}` |
> | [custom](https://github.com/invopop/gobl.mx.cfdi/blob/v0.68.0/addon/scenarios.go#L45) | `standard` `credit-note` | `{  "ext": {    "mx-cfdi-payment-method": "PPD"  }}` |

## Extensions

### Document Type

> [accordion] mx-cfdi-doc-type
>
> | Code | Name |
> | - | - |
> | `I` | Invoice |
> | `E` | Credit Note |
> | `P` | Payment |

### Relation Type

> [accordion] 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'.

> [accordion] 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.

> [accordion] 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.

> [accordion] mx-cfdi-prod-serv

### Fiscal Regime Code

Fiscal regime associated with suppliers and customers.

> [accordion] 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.

> [accordion] 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 investment |
> | `I03` | Transport equipment |
> | `I04` | Computer equipment and accessories |
> | `I05` | Dies, punches, molds, matrices and other tooling |
> | `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.

> [accordion] 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.

> [accordion] 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 were generated.

> [accordion] 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.

> [accordion] 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

> [accordion] mx-cfdi-global-year
>
> Pattern: `\d{4}`

### Cancellation Reason

Reason for cancelling a CFDI at the SAT. Reason 01 requires the UUID of the CFDI that substitutes it.

> [accordion] mx-cfdi-cancel-reason
>
> | Code | Name |
> | - | - |
> | `01` | Issued with errors, with relation |
> | `02` | Issued with errors, without relation |
> | `03` | The operation was not carried out |
> | `04` | Nominative operation included in a global invoice |

## 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](https://docs.gobl.org/overview/validation.md).

> [accordion] bill.Invoice
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | Invoice | <ul><li>Can convert to \[MXN]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-27` Invoice must be in MXN or provide exchange rate for conversion |
> | `tax.ext` | <ul><li>Ext require \[mx-cfdi-doc-type, mx-cfdi-issue-place, mx-cfdi-payment-method]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-01` Tax requires 'mx-cfdi-doc-type', 'mx-cfdi-issue-place', and 'mx-cfdi-payment-method' extensions |
> | `tax.ext` | <ul><li>Has global tag</li><li>Ext require \[mx-cfdi-global-period, mx-cfdi-global-month, mx-cfdi-global-year]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-02` Global invoices require 'mx-cfdi-global-period', 'mx-cfdi-global-month', and 'mx-cfdi-global-year' extensions |
> | `customer` | <ul><li>Has global tag</li><li>Empty</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-03` Cannot be set with global tag |
> | `payment` | <ul><li>Has global tag</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-04` Payment is required for global invoices |
> | `payment.advances` | <ul><li>Has global tag</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-05` Advances must be set with global tag |
> | `lines[*].item.ref` | <ul><li>Has global tag</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-06` Must be set with global tag |
> | `tax.ext` | <ul><li>No global tag</li><li>Ext require all or none of \[mx-cfdi-global-period, mx-cfdi-global-month, mx-cfdi-global-year]</li></ul> | `GOBL-MX-CFDI-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` | <ul><li>No global tag</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-08` Customer tax ID is required |
> | `customer.tax_id.code` | <ul><li>No global tag</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-09` Customer tax ID code is required |
> | `customer.ext` | <ul><li>Customer is Mexican</li><li>Ext require \[mx-cfdi-fiscal-regime, mx-cfdi-use]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-10` Mexican customer requires 'mx-cfdi-fiscal-regime' and 'mx-cfdi-use' extensions |
> | `customer.addresses` | <ul><li>Customer is Mexican</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-11` Mexican customer must have at least one address |
> | `customer.addresses[*].code` | <ul><li>Customer is Mexican</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-12` Customer address postal code is required |
> | `customer.addresses[*].code` | <ul><li>Customer is Mexican</li><li>Matches `^[0-9]{5}$`</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-13` Customer address postal code format is invalid |
> | `lines[*].item.ext` | <ul><li>No global tag</li><li>Ext require \[mx-cfdi-prod-serv]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-14` Item requires 'mx-cfdi-prod-serv' extension |
> | `lines[*].item.ext` | <ul><li>No global tag</li><li>Valid prod-serv</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-15` Product/service code must have 8 digits |
> | `tax.ext` | <ul><li>Has preceding</li><li>Ext require \[mx-cfdi-rel-type]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-16` Tax requires 'mx-cfdi-rel-type' extension when preceding documents are present |
> | `preceding[*].stamps` | <ul><li>Stamps have sat-uuid</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-17` Preceding row is missing 'sat-uuid' stamp |
> | `supplier.tax_id` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-18` Supplier tax ID is required |
> | `supplier.tax_id.code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-19` Supplier tax ID code is required |
> | `supplier.ext` | <ul><li>Ext require \[mx-cfdi-fiscal-regime]</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-20` Supplier requires 'mx-cfdi-fiscal-regime' extension |
> | `lines[*].quantity` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-21` Line quantity must be greater than 0 |
> | `lines[*].item.price` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-22` Line item price is required |
> | `lines[*].item.price` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-23` Line item price must be greater than 0 |
> | `lines[*].total` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-24` Line total must not be negative |
> | `discounts` | <ul><li>Empty</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-25` Document level discounts are not supported, use line discounts instead |
> | `charges` | <ul><li>Empty</li></ul> | `GOBL-MX-CFDI-BILL-INVOICE-26` Document level charges are not supported |

> [accordion] bill.Payment
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | Payment | <ul><li>Payment type in \[receipt]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-01` Only payment receipts are supported |
> | Payment | <ul><li>Can convert to MXN</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-02` Payment must be in MXN or provide exchange rate for conversion |
> | Payment | <ul><li>Line document currencies match</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-28` Line document currency must match the payment currency |
> | `ext` | <ul><li>Ext require \[mx-cfdi-doc-type, mx-cfdi-issue-place]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-03` Payment requires 'mx-cfdi-doc-type' and 'mx-cfdi-issue-place' extensions |
> | `ext` | <ul><li>Ext 'mx-cfdi-doc-type' in \[P]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-04` Payment document type must be 'P' |
> | `supplier.tax_id` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-05` Supplier tax ID is required |
> | `supplier.tax_id.code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-06` Supplier tax ID code is required |
> | `supplier.ext` | <ul><li>Ext require \[mx-cfdi-fiscal-regime]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-07` Supplier requires 'mx-cfdi-fiscal-regime' extension |
> | `customer` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-08` Customer is required |
> | `customer.tax_id` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-09` Customer tax ID is required |
> | `customer.tax_id.code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-10` Customer tax ID code is required |
> | `customer.ext` | <ul><li>Ext require \[mx-cfdi-use]</li><li>Ext 'mx-cfdi-use' in \[CP01]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-11` Customer's 'mx-cfdi-use' must be 'CP01' for payments |
> | `customer.ext` | <ul><li>Customer is Mexican</li><li>Ext require \[mx-cfdi-fiscal-regime]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-12` Mexican customer requires 'mx-cfdi-fiscal-regime' extension |
> | `customer.addresses` | <ul><li>Customer is Mexican</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-13` Mexican customer must have at least one address |
> | `customer.addresses[*].code` | <ul><li>Customer is Mexican</li><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-14` Customer address postal code is required |
> | `customer.addresses[*].code` | <ul><li>Customer is Mexican</li><li>Matches `^[0-9]{5}$`</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-15` Customer address postal code format is invalid |
> | `payee` | <ul><li>Empty</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-16` Payee cannot be represented in a CFDI payment |
> | `methods` | <ul><li>Length between 1 and 1</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-17` Exactly one payment method is required |
> | `methods[*].ext` | <ul><li>Ext require \[mx-cfdi-payment-means]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-18` Payment method requires 'mx-cfdi-payment-means' extension |
> | `methods[*].ext` | <ul><li>Ext 'mx-cfdi-payment-means' not in \[99]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-19` Payment means '99' (to define) is not allowed |
> | `lines[*].refund` | <ul><li>Empty</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-20` Refund lines are not supported |
> | `lines[*].installment` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-21` Installment number is required |
> | `lines[*].payable` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-22` Payable amount is required |
> | `lines[*].due` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-23` Due amount is required |
> | `lines[*].document` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-24` Line document is required |
> | `lines[*].document.stamps` | <ul><li>Stamps have sat-uuid</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-25` Line document requires the 'sat-uuid' stamp |
> | `lines[*].tax` | <ul><li>No rate surcharges</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-26` Tax rate surcharges are not supported |
> | `lines[*].tax` | <ul><li>Retained rates with percent</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-27` Retained tax rates must have a percent |
> | `preceding[*].ext` | <ul><li>Ext require \[mx-cfdi-rel-type]</li><li>Ext 'mx-cfdi-rel-type' in \[04]</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-29` Preceding row's 'mx-cfdi-rel-type' must be '04' |
> | `preceding[*].stamps` | <ul><li>Stamps have sat-uuid</li></ul> | `GOBL-MX-CFDI-BILL-PAYMENT-30` Preceding row is missing 'sat-uuid' stamp |

> [accordion] bill.Status
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `lines[*].ext` | <ul><li>Ext 'mx-cfdi-cancel-reason' in \[01, 02, 03, 04]</li></ul> | `GOBL-MX-CFDI-BILL-STATUS-01` Line 'mx-cfdi-cancel-reason' extension is not valid |

> [accordion] pay.Instructions
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `ext` | <ul><li>Ext require \[mx-cfdi-payment-means]</li></ul> | `GOBL-MX-CFDI-PAY-INSTRUCTIONS-01` Payment instructions require 'mx-cfdi-payment-means' extension |

> [accordion] pay.Record
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `ext` | <ul><li>Ext require \[mx-cfdi-payment-means]</li></ul> | `GOBL-MX-CFDI-PAY-RECORD-01` Payment advance requires 'mx-cfdi-payment-means' extension |

> [accordion] pay.Terms
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `notes` | <ul><li>Length at most 1000</li></ul> | `GOBL-MX-CFDI-PAY-TERMS-01` Notes length must be no more than 1000 |

> [accordion] addon.FoodVouchers
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `employer_registration` | <ul><li>Length at most 20</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-01` Employer registration must be no more than 20 characters |
> | `account_number` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-02` Account number is required |
> | `account_number` | <ul><li>Length at most 20</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-03` Account number must be no more than 20 characters |
> | `total` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-04` Total is required |
> | `lines` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-05` Lines are required |
> | `lines[*].e_wallet_id` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-06` Line e-wallet ID is required |
> | `lines[*].e_wallet_id` | <ul><li>Length at most 20</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-07` Line e-wallet ID must be no more than 20 characters |
> | `lines[*].issue_date_time` | <ul><li>Not zero</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-08` Line issue date and time is required |
> | `lines[*].employee` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-09` Line employee is required |
> | `lines[*].employee.tax_code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-10` Employee tax code (RFC) is required |
> | `lines[*].employee.tax_code` | <ul><li>Valid RFC</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-11` Employee tax code (RFC) must be valid |
> | `lines[*].employee.curp` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-12` Employee CURP is required |
> | `lines[*].employee.curp` | <ul><li>Matches `^[A-Z][AEIOUX][A-Z]{2}[0-9]{2}[0-1][0-9][0-3][0-9][MH][A-Z]{2}[BCDFGHJKLMNÑPQRSTVWXYZ]{3}[0-9A-Z][0-9]$`</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-13` Employee CURP format must be valid |
> | `lines[*].employee.name` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-14` Employee name is required |
> | `lines[*].employee.name` | <ul><li>Length at most 100</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-15` Employee name must be no more than 100 characters |
> | `lines[*].employee.social_security` | <ul><li>Matches `^[0-9]{11}$`</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-16` Employee social security number format is invalid |
> | `lines[*].amount` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FOODVOUCHERS-17` Line amount is required |

> [accordion] addon.FuelAccountBalance
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `account_number` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-01` Account number is required |
> | `account_number` | <ul><li>Length between 1 and 50</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-02` Account number must be between 1 and 50 characters |
> | `subtotal` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-03` Subtotal is required |
> | `total` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-04` Total is required |
> | `lines` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-05` Lines are required |
> | `lines[*]` | <ul><li>Valid line total</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-20` Line total must be quantity x unit\_price |
> | `lines[*].e_wallet_id` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-06` Line e-wallet ID is required |
> | `lines[*].purchase_date_time` | <ul><li>Not zero</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-07` Line purchase date and time is required |
> | `lines[*].vendor_tax_code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-08` Line vendor tax code is required |
> | `lines[*].vendor_tax_code` | <ul><li>Valid RFC</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-09` Line vendor tax identity code is invalid |
> | `lines[*].service_station_code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-10` Line service station code is required |
> | `lines[*].service_station_code` | <ul><li>Length between 1 and 20</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-11` Line service station code must be between 1 and 20 characters |
> | `lines[*].quantity` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-12` Line quantity must be greater than 0 |
> | `lines[*].item` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-13` Line item is required |
> | `lines[*].item.type` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-14` Line item type is required |
> | `lines[*].item.name` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-15` Line item name is required |
> | `lines[*].item.name` | <ul><li>Length between 1 and 300</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-16` Line item name must be between 1 and 300 characters |
> | `lines[*].item.price` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-17` Line item price must be greater than 0 |
> | `lines[*].item.unit` | <ul><li>One of \[mg, cg, g, kg, t, mm, cm, dm, m, lm, km, in, ft, lft, mm2, cm2, dm2, m2, ac, ha, mm3, cm3, dm3, m3, ml, cl, dl, l, kl, w, kw, kwh, kj, kcal, rate, yr, mon, wk, day, s, h, min, piece, item, pair, dozen, assortment, service, job, activity, trip, group, outfit, kit, basebox, pk, one, bag, box, bin, can, tub, case, tray, portion, set, roll, carton, cylinder, barrel, jerrican, carboy, demijohn, bottle, canister, pkg, pkt, bunch, bdl, blk, pallet, reel, sack, sheet, envelope, lot, unit]</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-27` Line item unit must be valid |
> | `lines[*].purchase_code` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-18` Line purchase code is required |
> | `lines[*].purchase_code` | <ul><li>Length between 1 and 50</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-19` Line purchase code must be between 1 and 50 characters |
> | `lines[*].taxes` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-21` Line taxes are required |
> | `lines[*].taxes[*].cat` | <ul><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-22` Line tax category is required |
> | `lines[*].taxes[*].cat` | <ul><li>One of \[VAT, IEPS]</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-23` Line tax category must be a valid value |
> | `lines[*].taxes[*].rate` | <ul><li>No percent</li><li>Present</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-24` Line tax rate is required when percent is not set |
> | `lines[*].taxes[*].rate` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-25` Line tax rate must be greater than 0 |
> | `lines[*].taxes[*].amount` | <ul><li>Min 0</li></ul> | `GOBL-MX-CFDI-FUELACCOUNTBALANCE-26` Line tax amount must be greater than 0 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.