Skip to main content
Stamping is one durable flow with different decisions for income, payment, credit, and reversal documents. The flow can stop at any boundary. A stop records the evidence and selects a safe next step instead of guessing.

The complete path

1

CargoWise sends the source

CargoWise outbound sends XML to Lambda ingress at /api/cargowise/stamping. Lambda authenticates the workspace, identifies the document, and stores the source capture before background work continues.
2

Lambda creates one document identity

The CargoWise DataSource/Key and the workspace are used to find the same logical document on a repeat push. A repeated message does not create a second invoice for the same identity.
3

Lambda maps the source

Lambda reads the document kind, amounts, tax lines, customer, currency, dates, parent references, and payment evidence. It stores a fiscal intent that represents the source at that point in time.
4

Lambda reconciles the intent

Lambda checks totals, tax data, parent identity, PUE or PPD evidence, payment balances, installments, currency conversion, and the selected route. Missing but recoverable parent work becomes Waiting for parent. Contradictory or unsafe evidence becomes a failure.
5

Lambda chooses the fiscal action

The document uses the enabled PUE, PPD, REP, Tipo E, or parent-cancellation route. The route is checked again at the action boundary, so a setting change cannot silently select another action.
6

Facturapi submits the operation

Facturapi validates the request and submits issuance or cancellation to SAT. Lambda records the exact provider attempt and its known outcome.
7

Lambda verifies and stores the result

Lambda checks the returned UUID, totals, payment complement, or cancellation result. It stores the XML, PDF, cancellation files, hashes, and the design snapshot used by that operation.
8

Lambda sends the files back

Lambda outbound sends each stored file to CargoWise inbound with the correct document type and purpose. A file retry continues delivery and never repeats fiscal issuance.

The main decisions

The detailed rules live in Income invoices, Payments, and Credits and cancellations.

Ingress response behavior

  • A new source that is durably accepted returns 202 and a Lambda document identity.
  • A repeat source returns 200 as a duplicate. If the original document is still only Received, Lambda can use the repeat to restore missing work enqueueing.
  • An exact repeat is idempotent. Changed fiscal evidence is normal new ingress and never rewrites an older capture. An issued document keeps its fiscal result and records any observed drift.
  • A 202 means Lambda accepted the source into durable work. It does not mean that SAT issued the CFDI.

Who owns what

Lambda does not rewrite CargoWise accounting facts or duplicate Facturapi and SAT validation rules.

Independent results

If the fiscal result exists but delivery is pending, the document is not an issuance failure. Use Files and delivery and Recovery.