FISCALISTO / API
Sales orders
Record what your customer ordered, deliver it with its delivery note, invoice what was delivered in one or several parts and know when it was paid.
A sales order (sor_…) is what your customer buys from you: the line items, their purchase order and when they expect it. You deliver it in one or several parts, each with its delivery note (REM-1, REM-2…), and invoice it in one or several invoices. Its status follows what happens on its own: draft → confirmed → partially_delivered → delivered → invoiced → paid (or closed, canceled). An order isn't a CFDI; each invoice that comes from it is.
Create one
curl https://api.fiscalisto.com/v1/sales_orders \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer": "cus_OufpKqnrvx9p42",
"customer_po": "OC-778",
"payment_form": "99",
"payment_method": "PPD",
"items": [
{ "description": "Silla de oficina ergonómica", "product_key": "56101504", "quantity": 100, "unit_price": 1850 }
],
"expected_on": "2026-11-20",
"payment_days": 30,
"confirm": true
}'The line items and payment terms are an invoice's and are checked with the same rules, so each invoice that comes from the order stamps. customer is a customer from your catalog (cus_…) or one with their tax data (added to your customers). With "quote": "quo_…" the order comes from a quote, with its customer and line items, and the quote is accepted.
Without confirm it stays a draft (draft) and changes with POST /v1/sales_orders/{id}; confirm it with POST /v1/sales_orders/{id}/confirm. Once confirmed, with inventory what was ordered is reserved in the warehouse and it can be delivered and invoiced.
invoice_policy says what gets invoiced: delivered (default), what's already delivered; ordered, everything ordered from the start (for example with prepayment). Services aren't delivered: they're invoiced from the first invoice.
Deliver
curl https://api.fiscalisto.com/v1/sales_orders/sor_OufpKqnrvx9p5Rt2mZr1XyT5uBcW8sKdLx/deliveries \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [{ "line": 31, "quantity": 60 }],
"carrier": "Paquetexpress",
"tracking": "PX-90122"
}'line is the id of each line item in the order's items. Without items, everything still missing goes out. Goods leave the warehouse with the delivery, not with the invoice. If the issuer doesn't sell without stock, no more than there is goes out (400 sales_order_invalid). Each delivery carries its delivery note on the order's PDF and your customer signs it on their link; if you already know who received it, send it in received_by.
POST /v1/sales_orders/{id}/deliveries/{dlv_…}/cancel returns the goods to the warehouse. POST /v1/sales_orders/{id}/cancel_remaining leaves the order with what was already delivered.
Invoice
curl https://api.fiscalisto.com/v1/sales_orders/sor_OufpKqnrvx9p5Rt2mZr1XyT5uBcW8sKdLx/invoice \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: PED-12-factura-1" \
-d '{}'Stamps an invoice with what's delivered and not invoiced (or what items says), with the tax data the customer has in your catalog today and the note «Pedido PED-12 · Su orden de compra OC-778». It returns the invoice, like POST /v1/invoices. Each call with a new Idempotency-Key stamps the next part; repeating it with the same one returns the same invoice. If nothing is left to invoice, 400 sales_order_invalid.
With include_undelivered: true it also invoices what isn't delivered yet. With deliver: true, stamping also records the delivery of what it carries (counter sale).
The order becomes paid when its invoices are paid: a PUE one when stamped, a PPD one with its payment complements or when the deposit is reconciled. invoices carries each invoice with what's left to pay (balance), and paid_total the sum paid. If you cancel an invoice, what it carried can be invoiced again.
Send it to your customer
POST /v1/sales_orders/{id}/send emails it with its PDF and the link (url) where your customer confirms it, signs each delivery with «Ya lo recibí» (I received it), downloads their delivery notes and opens their invoices. With "send_email": false it only returns url. GET /v1/sales_orders/{id}/pdf gives the PDF.
Events
| Event | When |
|---|---|
sales_order.confirmed | It was confirmed (through the API or from the app). |
sales_order.customer_confirmed | Your customer confirmed it on their link (customer_confirmed_at). |
sales_order.delivered | Everything ordered has gone out (delivered_at). |
sales_order.paid | Its invoices are paid (paid_at). |
sales_order.canceled | It was cancelled (cancel_reason). |
Close, cancel or reopen
| Route | What for |
|---|---|
POST /v1/sales_orders/{id}/close | Marks it finished even if something is pending, and releases what was reserved. |
POST /v1/sales_orders/{id}/cancel | Only without deliveries or stamped invoices. Deletes its draft invoices and releases what was reserved. |
POST /v1/sales_orders/{id}/reopen | A closed or cancelled one is open again. |
DELETE /v1/sales_orders/{id} | Deletes a draft. |
close and cancel accept reason, which stays in its history.
Was this page helpful?