FISCALISTO / API
Self-invoicing
Record each sale as a ticket and let your buyer invoice themselves, on your page or on the issuer's portal; whatever nobody invoices goes into the global invoice.
With self-invoicing you don't ask every buyer for tax data. You record the sale as a ticket, give the buyer its code (printed on the receipt, in the purchase email or on your page) and they invoice themselves: they type the code and the total, give their tax data (typed or read from their constancia) and the invoice is stamped right then with your account's timbres, with its PDF and XML to download.
Whatever nobody invoices within the window goes on its own into the period's global invoice (general public), stamped the morning after the period ends.
Record a sale
curl https://api.fiscalisto.com/v1/tickets \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folio": "A1042",
"total": 580,
"payment_form": "04",
"product_key": "90101501",
"description": "Consumo de alimentos",
"sold_at": "2026-10-24T14:32:00-06:00"
}'The line item comes from product_key and description (with iva, 0.16 by default) or from a product in your catalog with product: "prd_…". The total includes taxes; the tip goes separately in tip and isn't part of the invoice.
Also send buyer (name and email) if you know who paid: the ticket returns it and the app's Tickets shows it under the folio, to recognize the sale without opening your system. It isn't the invoice's receiver (the buyer types that on the portal and it arrives in customer) and nothing is sent to them. Tickets from the Stripe app carry it on their own, from the payment's customer.
If the sale was made at a branch, send branch ("brn_…"): the invoice the buyer makes goes out from it, with its zip as LugarExpedicion and its address, and the self-invoicing portal shows the branch's trade name and logo instead of the issuer's. Without branch the ticket belongs to the Matriz (branch: null). A branch of another issuer, or an archived one, answers 400. The global invoice still goes out from the Matriz.
Returns 201 with the ticket:
{
"id": "tkt_OufpKqnrvx9p6hW1yQbT3mZr8sKdLx0VeN",
"object": "ticket",
"livemode": false,
"issuer": "iss_OufpKqnrvx9p",
"folio": "A1042",
"code": "A1042-K7QX",
"status": "pending",
"url": "https://fiscalisto.com/autofactura/Tx8mQ2vLp9WnR4c?c=A1042-K7QX&t=580",
"total": 580,
"tip": 0,
"payment_form": "04",
"description": "Consumo de alimentos",
"product_key": "90101501",
"lines": [
{
"product": null,
"description": "Consumo de alimentos",
"product_key": "90101501",
"unit_key": "E48",
"iva": "0.16",
"quantity": 1,
"total": 580
}
],
"sold_at": "2026-10-24T14:32:00-06:00",
"invoiceable_until": "2026-10-31",
"invoice": null,
"global_invoice": null,
"customer": null,
"buyer": { "name": "Laura Méndez", "email": "laura@example.com" },
"branch": null,
"created_at": "2026-10-24T14:32:05-06:00"
}The folio is unique per issuer: recording the same folio again with the same total returns the same ticket, so you can retry safely. With another total it returns 409 ticket_folio_taken.
A sale with several line items
A hotel charges the nights, the breakfast and the laundry on one folio, each with its SAT key and its taxes (lodging carries ISH; breakfast doesn't). Send them in lines: each line item with its product or with product_key, description and iva, its units in quantity (1 by default) and what was charged for it in total, taxes included. Up to 200 line items per ticket.
curl https://api.fiscalisto.com/v1/tickets \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folio": "RES-88412",
"payment_form": "04",
"sold_at": "2026-10-31T23:30:00-06:00",
"lines": [
{ "product": "prd_OufpKqnrvx9p2", "quantity": 3, "total": 4770 },
{ "product_key": "90101501", "description": "Desayuno buffet", "quantity": 2, "total": 580 },
{ "product_key": "91111502", "description": "Lavandería", "total": 232 }
]
}'The ticket's total is the sum of its line items: you can omit it, and if you send it, it must match. With lines don't send product, description, product_key, unit_key, iva, local_taxes or ieps on the ticket. The ticket returns them in lines; description and product_key are the first one's.
Each line also takes detail (text, up to 200 characters): what only this sale says, like a stay's nights, dates and reservation number. Send the concept's name in description ("Hospedaje") and the rest in detail ("6 noches, del 14 al 20 de noviembre de 2026 · Reservación 12345"). With the detail, the invoice's Descripcion is Hospedaje · 6 noches, del 14 al 20 de noviembre de 2026 · Reservación 12345; without it, just Hospedaje. If the portal merges concepts into one per category, the category's name replaces both. The business decides when it goes in invoice_concepts.line_detail of self_invoicing (in the app, Autofactura › Detalle de los conceptos): customer (default), the buyer sees the Incluir el detalle en la descripción checkbox unticked at the portal and ticks it if they want it; always, it always goes, no checkbox, and never, it never goes, no checkbox. An invoice the buyer doesn't make at the portal carries it only with always. The checkbox's text changes in portal_style.texts.detail_label. The ticket returns it in lines[].detail (null when it has none). A detail over 200 characters answers 400 with param lines.N.detail.
The invoice the buyer makes carries one line item per line, with its key, its IVA and its local taxes, and the ticket's folio as NoIdentificacion. In the global invoice the ticket is still «Venta» with key 01010101, but one per tax combination it has (for example, lodging at 16% with ISH and breakfast at 16% without it), all with the same folio.
Local taxes on a line item
A line item that doesn't come from a catalog product sends its local taxes, such as the lodging ISH, in its line's local_taxes (or the ticket's, if it has a single line item). They have the shape of a product's local_taxes: name, its name in the CFDI («ISH»); rate, in percent (3.5 is 3.5%, up to 2 decimals), and retention, false for a transfer that adds or true for a withholding. A line item with product carries the product's: if it also sends local_taxes, the answer is 400 with param lines.N.local_taxes. With lines, they go on each line, not on the ticket.
Its IEPS works the same way: a line item with product_key sends ieps, a rate from c_TasaOCuota (0.08 for snacks and sweets) or, with ieps_factor Cuota, pesos per unit (a soft drink's per-litre quota). The total includes it, because goods with IEPS are offered with the tax in the price (article 19, section II of the IEPS Law). Fiscalisto backs out the base, the IEPS and the IVA, which applies to the base plus the IEPS (article 12 of the IVA Law): $25.06 of snacks is a 20.00 base, 1.60 of IEPS and 3.46 of IVA. The factura global breaks it out in the «Venta» of each rate or quota (RMF 2026 rule 2.7.1.21); the buyer's invoice shows it apart only if your customer has ieps_taxpayer and the goods allow it, and otherwise inside the price, with the same total. A line item with product carries the product's: if it also sends ieps, the answer is 400 with param lines.N.ieps. The ticket returns it in lines[].ieps and lines[].ieps_factor (null without IEPS).
curl https://api.fiscalisto.com/v1/tickets \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folio": "RES-88413",
"payment_form": "04",
"sold_at": "2026-10-31T23:30:00-06:00",
"lines": [
{
"product_key": "90111800",
"description": "Hospedaje habitación doble",
"quantity": 2,
"total": 2390,
"local_taxes": [{ "retention": false, "name": "ISH", "rate": 3.5 }]
},
{ "product_key": "90101501", "description": "Desayuno buffet", "total": 290 }
]
}'Each line's total still includes all its taxes: Fiscalisto backs out the base with its IVA and its local taxes (1,195.00 with IVA 16% and ISH 3.5% is a base of 1,000.00, 160.00 of IVA and 35.00 of ISH). The local taxes complement belongs to the whole invoice, not to each line item: it carries a single ISH at 3.5% with the sum of what each line item that has it gives, and breakfast doesn't go into it. The invoice's Total is the subtotal plus IVA plus the transferred local taxes, minus the withheld ones: what was charged. The global invoice, to the general public, carries only the transfers, in the «Venta» of each tax combination. The ticket returns them in lines[].local_taxes (empty if it has none), in its events too.
Let your buyer invoice
There are three ways, all with the same issuer portal:
- The code on the receipt. Print
codeand the issuer's portal (portal_urlfromGET /v1/issuers/{id}/self_invoicing). The buyer types the code and the total. - The link. Send
urlby email or WhatsApp: it carries the code (c) and the total (t), so the portal finds the ticket on its own and the buyer only gives their data. Whoever has the link can invoice that ticket, like whoever has the printed receipt: send it only to the buyer. If you build the link yourself,portal_url+?c=<code>&t=<total>does the same; withask_total: false,?c=is enough. - Inside your page, without the buyer leaving it, with
fiscalisto.jsor with React (below): your business's portal (portal_url) or a ticket's (url).
When the buyer invoices, ticket.invoiced (and invoice.stamped) arrives, and the ticket carries the invoice in invoice. If it goes into the global invoice, ticket.included_in_global arrives, with the global invoice in global_invoice.
If the buyer is a company (12-character RFC), their invoice withholds what each line item's product says (the product's iva_retention and isr_retention, as in With withholdings: professional fees or rent, 10% ISR and two thirds of the IVA) and, if the issuer is taxed under RESICO, 1.25% ISR (except on a line item with the exemption legend of rule 3.13.26 of the RMF 2026, «…se encuentran en el supuesto de exención…»). By default the base grows so the total is still what was paid; with retention_mode: "subtract" in self_invoicing the base is the ticket's and the withholding is subtracted, so the invoice's total is what was paid minus what was withheld. Either way the invoice states how much was withheld: it serves the company as its withholding certificate (rule 3.13.13 of the RMF 2026). Nothing is withheld from an individual, the general public or on the global invoice.
On your page with fiscalisto.js
The portal looks like a checkout: on one side the invoice, filling in while the buyer types (their data, the ticket's line items, IVA, local taxes and withholdings if they apply, with the same amounts that get stamped), and on the other the steps. On a phone, or in a narrow column, the invoice folds up at the top with its total.
So any of your customers can invoice on your site, put the issuer's portal (portal_url) in a div. No JavaScript needed:
<script src="https://fiscalisto.com/js/fiscalisto.js" defer></script>
<div data-fiscalisto-autofactura="https://fiscalisto.com/autofactura/Tx8mQ2vLp9WnR4c"
data-theme="light" data-accent="#0b7c77" data-radius="12"></div>Or a button that opens it in a window over your page, with the ticket already found. The window fits the screen: on a phone it takes the whole screen; on a computer it's a box as tall as the step (never taller than the browser window), with the invoice beside the form when the screen is wide. The main button always stays in view at the bottom:
<button data-fiscalisto-open="https://fiscalisto.com/autofactura/Tx8mQ2vLp9WnR4c?c=A1042-K7QX&t=580">
Facturar mi compra
</button>From JavaScript:
Fiscalisto.open(ticket.url, {
appearance: { theme: "dark", accent: "#1d4ed8" },
onComplete: (e) => console.log("Factura timbrada", e.uuid),
onClose: () => console.log("Cerró la ventana"),
});
// O dentro de un elemento, tan alto como su contenido:
Fiscalisto.mount("#factura", portalUrl, {
code: "A1042-K7QX", // opcional: el portal busca el ticket solo
total: 580,
onComplete: (e) => {},
});With the data-* attributes, the element receives the fiscalisto:complete event (in event.detail, the same as onComplete). If you add elements after the page loads, call Fiscalisto.scan().
It works the same with the link of a tax data request (customer_data_request.url): onComplete arrives with { kind: "customer_data" }.
Its appearance
Like Stripe Elements' appearance: the portal takes your site's theme, color and corners. Without these options it carries the ones the issuer saved for its portal (portal_theme, portal_accent and portal_radius of self_invoicing, or Autofactura › Cómo se ve el portal in the app), the same as its link and QR codes; the ones you send here win inside your site. In Fiscalisto, Autofactura › En su sitio web builds the code for you with a desktop and phone preview.
| Option | Attribute | Values |
|---|---|---|
appearance.theme | data-theme | "light", "dark" or "auto" (the buyer's device's; the default) |
appearance.accent | data-accent | Color of the main button and the focus ring, "#rrggbb". The button text is chosen white or black so it reads |
appearance.radius | data-radius | Corners in pixels, from 0 to 24 (default 10) |
preview | data-preview | false hides the live invoice and leaves only the form |
code, total | data-code, data-total | The ticket: the portal looks it up on its own |
A value it doesn't recognize is ignored. If you'd rather not use fiscalisto.js, the frame is the same link with ?embed=1 and these parameters: theme, accent (without #), radius, preview=0, c and t.
In React
npm install @fiscalisto/reactimport { FiscalistoEmbed, useFiscalistoDialog } from "@fiscalisto/react";
// Dentro de su página:
<FiscalistoEmbed
url={portalUrl}
appearance={{ theme: "light", accent: "#0b7c77", radius: 12 }}
onComplete={(e) => console.log(e)}
/>;
// En una ventana encima, con el ticket ya encontrado:
const { open, dialog } = useFiscalistoDialog({ heading: "Facture su compra" });
<button onClick={() => open(ticket.url)}>Facturar</button>;
{dialog}FiscalistoEmbed accepts appearance, preview, code and total, like fiscalisto.js.
What reaches your page
Only that the buyer finished, and their invoice's UUID. Their tax data never goes through your page: read it with GET /v1/tickets/{id} or with the ticket.invoiced webhook. Only self-invoicing and tax data links can be shown this way; an issuer's onboarding link, which asks for its e.firma, always opens separately.
The window and the global invoice
By default a ticket can be invoiced until the end of the sale's month (the usual rule at SAT) and the global invoice is monthly. To change it:
curl https://api.fiscalisto.com/v1/issuers/iss_OufpKqnrvx9p/self_invoicing \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "window": "days", "window_days": 7, "global_periodicity": "02" }'The portal also accepts ask_total: false so the buyer finds their ticket with the code alone (without the total), and your own words: portal_title, portal_message and code_hint (where the code is printed; null uses Fiscalisto's text). Its look goes in portal_theme (auto, light or dark), portal_accent (the buttons' color, "#0b7c77") and portal_radius (the corners, 0 to 24 pixels); null uses Fiscalisto's. They apply to the portal link, each ticket's link and inside your site, unless the embed code picks another appearance.
Everything else about its look goes in portal_style, the same as Autofactura › Cómo se ve el portal in the app: layout (checkout, the invoice beside the form; compact; or card, the form in a card), header (name_rfc, name, logo_name or logo), logo_size and logo_shape, colors (background, card, text, button_text), font and heading_font (from Google Fonts), heading_size, borders, shadow and density; what all its texts call the thing being invoiced (noun: ticket by default, nota, cuenta, compra, pedido, orden, reservacion, estancia or boleto; a hotel uses reservacion and its guest reads «Esta reservación ya se facturó», «This reservation has already been invoiced»); each screen's texts in Spanish and English (texts, like "submit": { "es": "Facturar", "en": "Get my invoice" }); which ways to give the data it offers (ways: constancia, qr, cif, recall, abroad, where the tax ID is optional, and norfc, «No tengo RFC», off by default, which invoices the person by name with XAXX010101000, régimen 616, uso S01 and the issuer's ZIP code; typing them is always there), whether the email is required (email_required), whether it states the deadline (show_deadline), a button at the end back to your site (back, with a label and an https url) and your own css (no @import or url()). Send only what changes: colors, ways and texts merge with what's saved and a text set to null is removed; "portal_style": null puts everything back to Fiscalisto's design. The «Facturado con Fiscalisto» line always stays.
{
"portal_style": {
"layout": "card",
"header": "logo_name",
"colors": { "background": "#f5f1e8" },
"font": "lora",
"texts": { "submit": { "es": "Facturar mi consumo", "en": "Invoice my stay" } },
"ways": { "abroad": false },
"back": { "label": "Volver a hotelcatedral.com", "url": "https://www.hotelcatedral.com" }
}
}By default the buyer's invoice carries one line item per ticket line (Hospedaje, Restaurante, Bar). With invoice_concepts (in the app, Autofactura › Conceptos de la factura) it can go in a single line item: mode: "single" with its description (by default «Consumo») and, if you want, its product_key and unit_key (otherwise those of the biggest line). A line item carries one set of taxes, so lines with other taxes (a night with ISH, 0 % IVA, a product's retentions) get their own: a hotel ends up with «Hospedaje» and its ISH, and «Consumo» with the rest. The total and taxes don't change, and the global invoice stays the same. With customer_choice: true the buyer picks in the portal, starting from mode. Send only what changes; "invoice_concepts": null goes back to itemized.
{
"invoice_concepts": {
"mode": "single",
"customer_choice": true,
"description": "Servicios de hospedaje y alimentos",
"product_key": "90111800"
}
}With mode: "grouped" (Por categoría) the business builds its own line items in groups (up to 12): each with its name, an optional product_key and the lines it takes, by sat_keys (the full SAT key or its start, 2 to 8 digits: "901015" takes 90101501 and 90101503) or by categories (product category paths as the catalog gives them, "Hotel › Habitaciones"; a category also takes the ones inside it). Each line goes in the first group that takes it; what none takes stays itemized, or with ungrouped: "group" goes in one more line item named ungrouped_name (by default «Otros»). SAT's rule still holds: a group with lines of other taxes splits into one line item per set of taxes. A category that doesn't exist gives parameter_invalid with the exact place (invoice_concepts.groups.0.categories.0); groups replaces the saved list.
With customer_choice: true, customer_options says which options the buyer sees (itemized, single, grouped; mode is always there and comes selected). That part of the portal's texts change in portal_style.texts with the keys concepts_title, concepts_itemized, concepts_single and concepts_grouped, in es and en.
{
"invoice_concepts": {
"mode": "grouped",
"customer_choice": true,
"customer_options": ["itemized", "single", "grouped"],
"groups": [
{ "name": "Alimentos y bebidas", "sat_keys": ["901015"], "product_key": "90101501" },
{ "name": "Hospedaje", "categories": ["Hotel › Habitaciones"] }
],
"ungrouped": "group",
"ungrouped_name": "Otros servicios"
}
}window: "days" gives window_days days from the sale; global_periodicity is the global invoice's c_Periodicidad (01 daily, 02 weekly, 03 fortnightly, 04 monthly). Each ticket says until when it can be invoiced in invoiceable_until.
For the portal's invoices to have their own series, send invoice_series (like "AF", up to 25 characters, no |): invoices the buyer makes in the portal and those issued from a ticket carry it, with their own folios. null or an empty one goes back to the issuer's invoice series; the global invoice doesn't use it.
With customer_notes: true, the portal asks the buyer for a note for their invoice's PDF (optional, up to 500 characters), like their purchase order number. It only goes on the PDF, never in the XML; you can change it later with notes in POST /v1/invoices/{id}. It's false by default.
When a buyer can't invoice, the portal tells them why. If it's their data (a name SAT doesn't recognize, a postal code that isn't the one on their constancia), it tells them how to fix it and nobody is alerted. If it's on the issuer's side (its CSD, its fiscal data, the PAC), an alert stays in Alertas and, with failure_email: true (default), the owners and admins get an email; with false, only the alert. Either way, under the error the portal says «¿Sigue con problemas? Escríbanos a … o llame al …» with the email and phone of the ticket's branch, or the issuer's reply-to email (Marca y documentos › Correo para respuestas in the app); what's missing is left out. That opening changes in portal_style.texts.error_help.
If your point of sale already makes the global invoice, send global_invoice: "off": Fiscalisto stops making it with these tickets, which stay pending after their window. Making the global invoice for those sales is then on you before SAT. "auto" turns it back on.
An issuer who is an individual under RESICO (regime 626) can send global_concepts: "summary": its global invoice carries only the period's total amount, one «Venta» line item per tax combination with NoIdentificacion «Resumen», instead of one per ticket (rule 2.7.1.21 of the RMF 2026 asks RESICO for «únicamente el monto total de las operaciones del periodo»; SAT accepts both). Fiscalisto remembers which tickets went into it: if it's cancelled or substituted, they all move. Any other issuer that sends it gets parameter_invalid; "ticket" (the default) goes back to one per ticket.
A receipt in several invoices
When each person pays their part, or someone wants several invoices from the same receipt (four of $250 from one of $1,000), the portal lets them split it if the issuer allows it. In self_invoicing, split_max is the most invoices a receipt can have, from 2 to 50, counting the one that takes all that's left (0, the default, doesn't allow splitting); split_min is the least each one can be, taxes included (100 by default), and less than that can't be left to invoice either, except by the invoice that takes all that's left; with split_same: true (the default) a buyer can make several with the same details at once. Each invoice uses a stamp.
{ "split_max": 4, "split_min": 100, "split_same": true }The buyer picks equal parts or an amount. Each invoice carries a share of every line item of the receipt, to the cent, with its own IVA, withholdings and local taxes; the parts and what's left always add up to the receipt. While something is left, the receipt stays pending with the same code and invoiced_amount says how much its invoices already cover: what nobody invoices goes into the global invoice of its period, only what was left. Once all of it is invoiced, the receipt is invoiced with invoice set to null, and each invoice has the receipt in tickets. If one of them is cancelled without a replacement, its amount is left to invoice again. A receipt with any part invoiced can't be cancelled with DELETE: cancel its invoices.
From the invoice to its ticket
Each invoice has tickets, the tickets (tkt_…) it invoices: the one your customer invoiced at the portal, the one your team invoiced from the ticket's page, or the ones associated with it; the ticket has invoice, so you can go from one to the other both ways. Its origin says what stamped it: { "type": "autofactura", "name": null } when it was your customer at the portal, with name "Stripe" or "Mercado Libre" when it stamped by itself with the buyer's data, and global_invoice when it's the global invoice Fiscalisto made by itself. In the app, the invoice shows the ticket in Viene de and its Historial says Timbrada en autofactura.
Cancel a ticket
A sale that didn't happen (a return, a till mistake) is cancelled with DELETE /v1/tickets/{id} while it's still pending: it can no longer be invoiced nor go into the global invoice. One already invoiced returns ticket_not_pending; cancel its invoice with POST /v1/invoices/{id}/cancel.
List
GET /v1/tickets gives the tickets newest to oldest by sale date, with status (pending, invoiced, global, cancelled) and sold_at_gte / sold_at_lte to filter.
In test mode everything works the same with your fk_test_ key: tickets are invoiced at no cost in the PAC's test environment and the invoices aren't real CFDI.
Was this page helpful?
Invoicing recipes
The most common invoices ready to copy: from your catalog, on credit (PPD), in dollars, with withholdings, global to the general public and in batch.
Online stores
Connect Shopify, WooCommerce, Tiendanube, Mercado Libre, Amazon, Mercado Pago, Conekta or Openpay: each paid order becomes a self-invoicing ticket, and whatever nobody invoices goes into the global invoice.