> ## 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.

# Currency

> How Lambda derives and verifies cross-currency payment values.

Lambda uses CargoWise accounting evidence to express one payment across the payment currency, each
parent document currency, and the MXN value recorded at payment time.

## Terms

| Term                      | Meaning                                                          |
| ------------------------- | ---------------------------------------------------------------- |
| Payment currency          | Currency of the receipt and `MonedaP`                            |
| Document currency         | Currency of one related parent and `MonedaDR`                    |
| Payment-time MXN evidence | MXN value allocated to the parent at the payment date            |
| `TipoCambioP`             | MXN value of one unit of payment currency                        |
| `EquivalenciaDR`          | Units of document currency equal to one unit of payment currency |

For a cross-currency parent:

```text theme={null}
payment amount = applied MXN / TipoCambioP

EquivalenciaDR =
  (document amount paid * TipoCambioP) / applied MXN
```

The payment-time MXN allocation connects both sides of the calculation. Lambda does not invent a
rate from current market data.

## Precision

| Value                                   | Precision            |
| --------------------------------------- | -------------------- |
| Exchange rates, including `TipoCambioP` | 6 decimal places     |
| `EquivalenciaDR`                        | 10 decimal places    |
| Monetary values                         | Currency minor units |

Intermediate comparisons allow one minor unit when rounding order can differ. After stamping,
Lambda verifies the returned complement against the reconciled values.

## Same currency

A receipt pays MXN 1,800 against an MXN parent.

| Value             | Result                                                     |
| ----------------- | ---------------------------------------------------------- |
| Payment currency  | MXN                                                        |
| Document currency | MXN                                                        |
| Payment amount    | MXN 1,800.00                                               |
| `TipoCambioP`     | Not required for MXN                                       |
| `EquivalenciaDR`  | Not required; a provider may represent the equality as `1` |

No conversion is needed.

## USD payment against an MXN parent

A USD 100 receipt is valued at MXN 18.00 per USD and applies MXN 1,800 to an MXN parent.

```text theme={null}
payment amount = 1,800 MXN / 18 MXN per USD = 100 USD

EquivalenciaDR =
  (1,800 MXN * 18 MXN per USD) / 1,800 MXN
  = 18 MXN per USD
```

The REP uses `TipoCambioP = 18.000000` and `EquivalenciaDR = 18.0000000000`.

## USD payment against a EUR parent

A USD 100 receipt is valued at MXN 18.00 per USD. It applies MXN 1,800 to EUR 90 of a EUR parent.

```text theme={null}
payment amount = 1,800 MXN / 18 MXN per USD = 100 USD

EquivalenciaDR =
  (90 EUR * 18 MXN per USD) / 1,800 MXN
  = 0.9 EUR per USD
```

The REP uses `TipoCambioP = 18.000000` and `EquivalenciaDR = 0.9000000000`.

## Missing or conflicting evidence

Lambda stops before issuance when:

* payment exchange-rate evidence is missing or invalid
* applied MXN is missing or invalid
* parent currency conflicts with the stamped parent
* the derived payment amount disagrees with receipt totals
* the stamped complement differs from the reconciled values

The workspace finding names the affected parent and the safe observed values.

See [Payments](/stamping/payments) for the complete REP behavior.
