RideKit
Docs/Reference/Mexico: riders invoice their own trips (CFDI 4.0)

Mexico: riders invoice their own trips (CFDI 4.0)

Built: 2026-11-03. Written for operators in Mexico and for whoever maintains the code.

In Mexico, a rider who wants to deduct a trip asks for a CFDI in their own name: their RFC, their name exactly as registered with SAT, their tax address postal code, their tax regime and what the invoice is for. Every trip already gets a CFDI to the general public (XAXX010101000, see backend/src/tax/). The rider's own CFDI replaces that one: it is related to it with type 04 (substitution), so no trip is invoiced twice.

What the rider sees

Menu → Billing details (only in a market that offers invoices):

  • RFC: 13 characters for a person, 12 for a company;
  • name or company name, in capitals, without the company type (no "S.A. de C.V.");
  • tax address postal code, 5 digits;
  • tax regime: 605, 612, 626, 625, 606, 621, 616 for people; 601, 603 for companies; 626 for both. A regime that does not match the RFC is refused;
  • use of the invoice: G03 general expenses, S01 no tax effect, CP01 payroll. With regime 616 (no tax obligations) only S01 is allowed, and the app switches to it when 616 is chosen;
  • email for invoices;
  • Invoice every trip: each completed trip is invoiced and emailed a few seconds after it ends.

A trip's receipt has an Invoice (CFDI) section:

  • with no billing details yet: Add your billing details;
  • otherwise Request invoice and the last day it can be requested;
  • once issued: the total, the RFC, where it was emailed, the tax folio (UUID) and Share XML;
  • or why it cannot be invoiced (too late, not finished, nothing paid).

The invoice is emailed with the XML attached. Without a PAC it is marked "not stamped by SAT yet".

What is invoiced

  • Only what the rider paid. Promos and amounts someone else paid are left out.
  • IVA is split out of that amount at the market's tax rate (16% in Mexico): subtotal = total ÷ 1.16.
  • One concept: passenger transport, product key 78111800, unit E48.
  • Payment form from how the trip was paid: cash 01, card 04, wallet 05, anything else 99. Payment method PUE.
  • The issue date (Fecha) is the Mexico City wall-clock time, local to the place of issue. A UTC time reads as hours in the future and a PAC refuses it.
  • A rider can request a trip's invoice within the market's window after the trip (60 days by default). Requesting twice returns the same invoice.

Where the operator finds it

Admin → Markets → Mexico → Tax → Riders' own invoices (Mexico):

  • turn it on or off (on by default in Mexico);
  • the window in days (1 to 365);
  • the platform's tax address postal code (LugarExpedicion). The drivers' withholding certificates use it as their place of issue too;
  • the platform's tax regime (601, 603 or 626).

The issuer's RFC comes from the tax settings (seller tax ID) or, failing that, the platform-workers employer block. The legal name comes from that block.

Admin → Tax Invoices → Riders' own invoices (CFDI) (needs tax.view):

  • pick a month (the market's calendar month);
  • totals: how many, how much, how many stamped, automatic, not emailed;
  • each invoice: date (links to the trip), who asked (rider or automatic), receiver name and RFC, total, tax folio (hover for the one it replaced), stamped or not, where it was emailed;
  • Export CSV for the accountant, in Spanish, every invoice of the month;
  • a warning while the platform's RFC, legal name or postal code is missing. A PAC refuses invoices without them.

Stamping

With a PAC connected (Admin → Providers → CFDI: base URL, user, password) the document is sent to POST {base}/stamp and the PAC's UUID and stamped XML are kept. Otherwise a stand-in UUID is made and the XML is marked as not stamped. Nothing breaks either way.

Code

  • backend/src/invoicing/rider-cfdi.ts: the rules, the profile check and the CFDI document (no I/O);
  • cfdi-xml.ts: the document as CFDI 4.0 XML;
  • rider-invoice.service.ts: the profile, requests, automatic invoices, stamping, email, the admin report and CSV;
  • rider-invoice.controller.ts: GET/PUT /rider/tax-profile, GET/POST /rides/:id/cfdi, GET /rides/:id/cfdi/xml, GET /admin/rider-invoices?month=, GET /admin/rider-invoices/csv?month=;
  • migration 1700000149000 (rider_tax_profiles, rider_cfdi_invoices);
  • email attachments: notifications/email/ (Resend, SMTP and the dev log);
  • rider app: app/(app)/billing.tsx, src/components/RiderCfdiCard.tsx;
  • admin: components/tax/RiderInvoicesReport.tsx, components/markets/RiderInvoicesCard.tsx.

Check with your advisers

  • the window your PAC and SAT accept for a substitution CFDI;
  • the product and unit keys;
  • your PAC's exact endpoint and payload;
  • whether your platform invoices the full fare or only its commission. That depends on how you are set up with SAT.
source: docs/rider-invoices-mexico.md (ships identically in the product zip)