> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaantonio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How stamping works

> The path from CargoWise accounting XML to a stamped CFDI and back to CargoWise.

Think of stamping as one continuous path with four owners. Each owner has a clear job. Lambda coordinates the path; it does not replace CargoWise accounting or SAT validation.

## The flow

```text theme={null}
CargoWise outbound (accounting XML)
        │
        ▼
Lambda ingress — store document, enqueue work
        │
        ▼
Validate + reconcile — fiscal checks, parents, balances
        │
        ├── pause with a note (waiting, failed, or system error)
        │
        └── eligible → Facturapi stamp → SAT UUID stored
                │
                ▼
        Lambda outbound — XML/PDF to CargoWise inbound
```

1. **CargoWise outbound** pushes an accounting document to Lambda.
2. **Lambda ingress** accepts it, stores the capture, and queues processing. CargoWise treats acceptance as delivered.
3. Lambda validates the document and reconciles linked parents, balances, and fiscal evidence.
4. When the document is eligible, **Facturapi** submits it to SAT and returns the stamped CFDI.
5. Lambda stores the SAT UUID and artifacts, then **Lambda outbound** delivers XML/PDF to **CargoWise inbound**.

## Who owns what

| Owner         | Owns                                                                                             |
| ------------- | ------------------------------------------------------------------------------------------------ |
| **CargoWise** | Accounting truth: amounts, match lines, FX evidence, transaction fields                          |
| **Lambda**    | Mapping, reconciliation gates, workspace status, notes, retries that are safe, artifact delivery |
| **Facturapi** | SAT/CFDI validation, stamp and cancellation submission, catalog and field rules                  |
| **SAT**       | Legal validity of the stamped or cancelled CFDI                                                  |

If a dependency already owns a rule, Lambda surfaces the result instead of inventing a second version of it.

## Stamp and delivery are separate

A document can be fiscally stamped while CargoWise delivery is still retrying. The CFDI is already issued; only the file handoff is incomplete.

The reverse also matters: delivery problems do not mean “stamp again.” Re-stamping a document that already has a SAT UUID creates fiscal risk.

## What “accepted” means

When Lambda ingress accepts a document, CargoWise stops retrying that push. If the workspace stays on **Received** or **Processing**, open the invoice timeline — the document is already inside Lambda, and the next step is workspace follow-up, not another CargoWise push of the same work.

## Document paths

The same pipeline serves different document shapes:

| From CargoWise                    | Lambda treats it as                           | Typical success                     |
| --------------------------------- | --------------------------------------------- | ----------------------------------- |
| Unstamped income invoice          | Income stamp                                  | **Stamped**                         |
| Payment receipt                   | Payment complement (REP) when PPD lines apply | **Applied**                         |
| Full credit / cancellation path   | Credit completion or CFDI cancellation        | **Credit completed**, **Cancelled** |
| Already-stamped Government Number | External stamp evidence                       | **Stamped externally**              |

Read the document guides next: [Income invoices](/stamping/income-invoices), [Payment complements](/stamping/payment-complements), and [Credits and cancellations](/stamping/credits-and-cancellations). For Lambda-only routes such as parent-cancel credits or REP eligibility windows, see [Special behaviors](/stamping/special/overview).

## Where to look when something stops

| Workspace signal                                     | Start here                               |
| ---------------------------------------------------- | ---------------------------------------- |
| Label is unclear                                     | [Statuses](/stamping/statuses)           |
| Note says the document or provider blocked the stamp | [Failures](/stamping/failures)           |
| Note points to configuration, delivery, or recovery  | [System errors](/stamping/system-errors) |
| You need how recovery and corrective retry stay safe | [Retry](/stamping/retry/overview)        |
| You need the next action                             | [Troubleshooting](/troubleshooting)      |
