Skip to content

Contact

Mexico City, Mexico
Available for remote and on-site projects.

Professional networks

LinkedIn · GitHub · Email
Applied engineering, measurable results.

Online store with CFDI 4.0 e-invoicing in WooCommerce

· Updated · 11 min read · Samuel Torres

Short answer

A WooCommerce store can issue CFDI 4.0 invoices (Mexico's electronic invoice) by connecting to an authorized stamping provider (PAC) through a plugin. There are two ways: customers invoice themselves from a page on your store, or you invoice from the order in the admin. Either way you need your digital seal certificate (CSD) and the tax data validated before stamping.

Why invoicing by hand costs you sales

In Mexico, many B2B purchases don't close without an invoice. If customers have to message you, wait and email you their details, some of them will buy from whoever invoices instantly. On top of that, typing tax IDs (RFC), tax regimes and CFDI usage codes by hand creates errors that have to be cancelled and reissued.

This article doesn't replace your accountant: they decide your tax regime, how often you issue your global invoice and how each sale is recorded. What I do explain is how those SAT rules translate into an online store that invoices on its own, and what the system has to do so it doesn't create extra work for you.

What CFDI 4.0 asks of your customer

With CFDI 4.0, the SAT (Mexico's tax authority) requires the invoice to carry the recipient's tax data exactly as it is registered with their RFC. If one field doesn't match, the stamping provider rejects it and the customer gets no invoice. According to the SAT infographic on recipient data, these are the fields:

FieldWhat it isTypical mistake in a store
Name or company nameExactly as shown on the tax status certificate (Constancia de Situación Fiscal), in capital lettersThe customer adds "SA de CV" or types the brand name
RFC13 characters for individuals, 12 for companiesOne letter or digit mistyped
Tax postal codeThe postal code of the tax address registered with the SATUsing the delivery postal code instead
Tax regimeThe SAT catalog code that belongs to that RFCPicking a regime the customer doesn't have
CFDI usageWhat the invoice will be used for (c_UsoCFDI catalog)A usage that doesn't match their regime

The safest approach is to ask customers for their tax status certificate or have them copy their data from it. A good self-invoicing form only shows the CFDI usages that match the selected regime, instead of a list of twenty options.

The two ways to invoice from WooCommerce

There are two ways to connect the store to invoicing, and the difference is who enters the tax data and who clicks "stamp". It isn't a technical decision: it depends on how many orders you invoice each month, who your customers are and how much time your team has to deal with errors.

Self-invoicing: customers open a page on your store, enter their order number, fill in their tax details and download their PDF and XML. It's the option that leaves you the least work.

Invoicing from the order: you (or your team) issue the invoice from the order screen. More control, but more operational work.

Many stores combine both: self-invoicing for the public and manual invoicing for special cases.

Self-invoicingInvoicing from the order
Who enters the tax dataThe customerYour team
Work per invoice for youNone if the data is correctEnter, review and stamp each one
Who fixes a PAC rejectionThe customer, with the error shown on screenYour team, by email or phone
Risk of invoicing twiceLow if the system blocks already-invoiced ordersDepends on someone checking
Best whenMany small orders, mostly end customersFew large orders, B2B customers with special terms
What needs setting upPublic page, validations and a rule for which orders can be invoicedPermissions for who can stamp and cancel

What the system has to validate before stamping

The expensive mistake isn't failing to invoice: it's invoicing wrong. An invoice with the wrong data has to be cancelled and reissued, which costs your team time and your customer's trust. That's why the system should validate at least:

  • An RFC with a valid format.
  • Tax postal code, tax regime and CFDI usage against the SAT catalogs.
  • That the invoice amount matches what was actually charged.
  • That an order can't be invoiced twice.
  • That the order is already paid before it can be invoiced (I explain why below).

The global invoice for the general public

In most stores, the majority of buyers don't ask for an invoice. Those sales don't disappear: they are reported in a global invoice issued to the general public. The system has to know which orders were already invoiced to a specific customer so they aren't included twice.

According to the SAT's global CFDI filling guide, the global invoice uses the generic RFC XAXX010101000, the name PUBLICO EN GENERAL, regime 616 (no tax obligations) and usage S01 (no tax effects). CFDI 4.0 added the periodicity, months and year fields to state which period it covers.

In practice, for an online store this means three things:

  • Your accountant sets the periodicity (daily, weekly, biweekly, monthly), and the store has to be able to export the uninvoiced sales for that period.
  • An order invoiced in the customer's name doesn't go into the global invoice. If self-invoicing happens after you already issued the global invoice, the SAT has a specific cancellation reason for that case (you'll see it in the table below).
  • Decide how long after purchase you accept self-invoicing for an order, aligned with your global invoice period. You set that rule with your accountant; the system just enforces it.

Cancelling an invoice: reasons and deadlines

Cancelling isn't deleting. Since 2022 every cancellation must carry a reason, and in several cases the customer has to accept it. If your store issues many invoices, it pays to understand this before the first "I got my RFC wrong" arrives. These are the reasons the SAT lists on its cancellation process page:

CodeReasonExample in a store
01Invoice issued with errors, with a related replacementThe customer picked the wrong regime: you issue the correct invoice, related to the old one, and then cancel the old one
02Invoice issued with errors, without a related replacementAn error that doesn't require a new invoice to replace it
03The transaction did not take placeThe order was invoiced and then the sale was cancelled
04Named transaction related to a global invoiceA sale that was already in the global invoice, and then the customer asked for an invoice in their name

Customer acceptance. According to the same SAT page, the recipient has three business days from receiving the request to accept or reject it; if they don't respond, it is considered accepted. Acceptance isn't needed, among other cases, when the invoice's total value is up to MXN $1,000.00, when it's cancelled within the business day after it was issued, and for transactions with the general public.

The deadline to cancel. Article 29-A of the Federal Tax Code (CFF) allows cancellation no later than the month in which the annual income tax (ISR) return for the year the invoice was issued must be filed. A March invoice, for example, can't be cancelled indefinitely.

For the store, the lesson is practical: if you validate the data well before stamping, you'll rarely cancel. And when you do, the system should record who did it, with which reason and which invoice replaced it.

Do you need a payment complement?

For most online sales, no. The payment complement (also called the electronic payment receipt) is for invoices issued before the money comes in, with payment method PPD (payment in installments or deferred). When the customer paid in full at the time the invoice is issued, the method is PUE (single payment) and no complement is needed.

That's how the SAT's payment complement filling guide explains it. In a store where customers pay by card at checkout, the sale is already collected when it's invoiced: PUE, no complement.

The risk is in payments that aren't immediate: bank transfer, cash deposit at a convenience store, or B2B orders on credit. If the system lets customers invoice an order that is still "awaiting payment", you end up with a PUE invoice for something you haven't collected, or with the obligation to issue complements. The simplest rule: only paid orders can be self-invoiced. Credit sales, if you have them, are invoiced from the order with PPD, and your accountant defines how complements are handled.

How to choose a PAC (without marrying the first one)

The PAC is the SAT-authorized provider that validates and stamps your invoices. The SAT publishes the list of authorized certification providers, plus lists of revoked or non-renewed ones. I won't recommend one: here's what I'd ask before signing up.

  1. Are you an authorized PAC or do you resell another provider's stamps? Many invoicing services are a layer on top of a PAC. That's fine, but you should know who your stamping depends on.
  2. Do you have a WooCommerce plugin or API, and who maintains it? An abandoned plugin stops working at the next WordPress or WooCommerce update.
  3. How much does each stamp cost and what happens when they run out? Ask whether stamp packages expire and whether they warn you before you hit zero on a Friday night.
  4. Can cancellations and the global invoice be done from the store? If not, your team will end up logging into another portal anyway.
  5. Can I download all my XML files if I switch providers? Your invoices are yours; confirm you can take them with you.
  6. Do you have a test environment? Without one, every test is a real invoice you then have to cancel.

Costs almost nobody mentions

The plugin may be free and invoicing still has a cost: the PAC charges per stamp, you need a valid CSD, and someone has to handle rejected invoices. Ask how much each stamp costs and who deals with errors before you choose a provider.

Add maintenance too: every WooCommerce or invoicing plugin update can change how the order is read. If nobody tests invoicing after updating, you find out when a customer writes to say they can't download their invoice.

How I built it for Blanco Detalle

For Blanco Detalle I built a WooCommerce store with product personalization, tiered wholesale pricing, shipping through more than 150 couriers and CFDI invoicing. The store runs on about 50 active plugins, and that's where the lesson is: invoicing is connected to a stamping provider (PAC) through a plugin, with the tax data validated before each invoice is stamped.

Customers invoice themselves from the store, payments come in through Mercado Pago and PayPal, and PDF invoices and packing slips are generated automatically. The full details are in the Blanco Detalle case.

Blanco Detalle's WooCommerce cart with live shipping calculation
Blanco Detalle's WooCommerce cart with live shipping calculation

If your store already sells and you want it to invoice on its own, or you're building one with these rules from day one, take a look at the custom web development service or write to me with how many orders you invoice per month and how you collect payments today.

Related: Blanco Detalle case · Custom web development and online stores

FAQ

Can I issue CFDI 4.0 invoices from WooCommerce without using the SAT portal?

Yes. A plugin connected to a stamping provider generates the XML, stamps it and delivers the PDF and XML to the customer. You upload your digital seal certificate to the provider once and everything else happens from the store.

What do I need to get started?

A working WooCommerce store, your e.firma to request the CSD, an account with a stamping provider, and a decision on whether customers invoice themselves or you invoice from the order.

Does it work for wholesale sales?

Yes. What matters is that the invoiced price matches what was charged, volume discounts included, and that the system doesn't allow an order to be invoiced twice.

What happens to orders nobody invoiced?

They're reported in the global invoice to the general public, with the generic RFC XAXX010101000. The store has to separate orders already invoiced in a customer's name so they aren't included twice; your accountant sets how often the global invoice is issued.

Does my store need a payment complement?

If the customer pays in full at checkout, no: the invoice uses method PUE (single payment). The complement applies to PPD invoices, issued before payment, such as credit sales. That's why only paid orders should be eligible for self-invoicing.

Samuel Torres Pichardo

Samuel Torres Pichardo · Software and Cloud Engineer · Mexico City
I run more than 23 sites in production.
About me · LinkedIn

Want something like this for your business?

Get a quote on WhatsApp in 2 min

Menu

Español

samuelnegociosnegocios@gmail.com