# SAT for developers

> What you need to know about Mexican e-invoicing to integrate it well: CFDI, timbre, PAC, CSD, tax regime, CFDI use, PUE and PPD.

If this is your first time integrating invoicing in Mexico, this page explains the pieces in five minutes. Fiscalisto takes care of the rules; you only need to understand what you're asking for.

## The pieces

| Term | What it is |
| --- | --- |
| **CFDI** | Comprobante Fiscal Digital por Internet: the electronic invoice. It's an XML in a format defined by SAT (version 4.0 today). The PDF is only a printed representation. |
| **SAT** | Servicio de Administración Tributaria, Mexico's tax authority. It receives a copy of every CFDI. |
| **Timbre** (stamp) | The signature with which a PAC certifies the CFDI and assigns its folio fiscal (UUID). Without a timbre it isn't a valid invoice. |
| **PAC** | Proveedor Autorizado de Certificación: the company SAT authorizes to stamp CFDI. Fiscalisto already stamps with one; you don't need to hire it. |
| **UUID** | The folio fiscal: the CFDI's unique identifier at SAT, like `5F1E8C2A-3B7D-4C9E-A1B2-C3D4E5F60718`. |
| **RFC** | Registro Federal de Contribuyentes, the tax ID: 12 characters for a company (persona moral), 13 for an individual (persona física). |
| **CSD** | Certificado de Sello Digital: the certificate (`.cer` and `.key`) the issuer seals its CFDI with. The issuer requests it from SAT. |
| **e.firma** | The taxpayer's electronic signature (formerly FIEL). It can't seal invoices, but it's used to request the CSD and to authorize the PAC. |
| **Constancia de situación fiscal** | SAT's document with an RFC's official name, tax regime and postal code. The customer's data must match it. |

## What an invoice carries

- **Emisor** (issuer): who invoices. In the API it's your `issuer`.
- **Receptor** (receiver): who is invoiced, the `customer`. Since CFDI 4.0 their name, tax regime and postal code must be exactly the ones on their constancia de situación fiscal; otherwise SAT rejects it. It's the most common rejection.
- **Conceptos** (line items): what's sold, the `items`. Each carries a product or service key (`product_key`, from the c_ClaveProdServ catalog) and a unit key (`unit_key`). Search them with [`GET /v1/sat_catalogs/product_keys?q=…`](https://fiscalisto.com/en/docs/api/referencia/catalogos-del-sat/get-sat-catalog).
- **Taxes**: transferred IVA (16%, 8% in the border region, 0% or exempt), IEPS, and IVA and ISR withholdings when they apply. Fiscalisto calculates the amounts.

## Tax regime and CFDI use

The **tax regime** (`tax_system`) is how each taxpayer is taxed: 601 general regime for companies, 612 individuals with business activity, 626 RESICO, 616 no tax obligations, among others.

The **CFDI use** (`use`) is what the customer will use the invoice for: G03 general expenses, G01 purchase of goods, I04 computer equipment, S01 no tax effects, and others. Each use is only valid with certain regimes; Fiscalisto checks it before stamping and tells you if it doesn't fit. If you don't send it, it uses G03 (or S01 if the customer is 616).

## PUE and PPD

The **payment method** says whether the invoice is already paid:

- **PUE**, paid in a single payment: paid in the month it's issued. It carries the real payment form (`payment_form`: 01 cash, 03 transfer, 04 credit card, 28 debit card…).
- **PPD**, paid in installments or later: paid afterwards or in parts. The payment form is 99 (to be defined) and each payment you receive is documented with a [payment complement](https://fiscalisto.com/en/docs/api/pagos-y-notas-de-credito).

If you don't know whether you'll be paid this month, use PPD.

## Document types

| `type` | Document | In the API |
| --- | --- | --- |
| I | Ingreso (income): a sale. Also the global invoice. | `POST /v1/invoices` |
| E | Egreso (expense): credit note, discount or return. | `POST /v1/credit_notes` |
| P | Pago (payment): the payment complement of a PPD invoice. | `POST /v1/payments` |
| T | Traslado (transfer): covers goods in transit, usually with Carta Porte. | `POST /v1/invoices` with `"type": "T"` |
| N | Nómina (payroll): an employee's receipt. | `POST /v1/payroll_receipts` |

Withholding certificates are another kind of document (Retenciones 2.0), in [`POST /v1/retentions`](https://fiscalisto.com/en/docs/api/referencia/retenciones/create-retention).

## General public and the global invoice

If you sell to someone who doesn't ask for an invoice, that sale is invoiced later in a **global invoice** together with the others of the period, to the generic RFC `XAXX010101000` with the name `PUBLICO EN GENERAL`. See the [recipe](https://fiscalisto.com/en/docs/api/facturas#global-to-the-general-public).

A foreign customer without a Mexican RFC carries the generic RFC `XEXX010101000`, with their country and tax registration number in `customer.foreign`.

## Deadlines worth knowing

- A CFDI's date can be up to 72 hours before the moment it's stamped.
- Payment complements are stamped no later than the fifth calendar day of the month after the payment.
- Cancelling an invoice over $1,000 waits for the customer's acceptance (see [Cancel and replace](https://fiscalisto.com/en/docs/api/cancelacion)).
