# `X402.AuthCapture.Receipt`
[🔗](https://github.com/cardotrejos/x402/blob/v0.9.6/lib/x402/auth_capture/receipt.ex#L1)

Strict auth-capture receipt identity and escrow-event checks.

Expected events come from the execution layer's full verification result,
not a request-provided assertion. Successful receipts must contain exactly
one matching event from the configured escrow, with canonical ABI data and
matching transaction/block provenance. Reverted receipts must have no logs.

This pure check does not establish chain identity, canonical inclusion, or
finality. The execution layer must check those against its trusted RPC before
recording a final journal outcome. Contract addresses are deployment
configuration, not independent runtime-code authenticity proofs.

# `event`

```elixir
@type event() :: %{address: String.t(), topics: [String.t()], data: String.t()}
```

# `identity`

```elixir
@type identity() :: %{hash: String.t(), from: String.t(), to: String.t()}
```

# `inclusion`

```elixir
@type inclusion() :: %{
  outcome: :confirmed | :reverted,
  block_hash: String.t(),
  block_number: non_neg_integer(),
  transaction_index: non_neg_integer()
}
```

# `check`
*since 0.9.0* 

```elixir
@spec check(term(), identity(), event()) :: {:ok, inclusion()} | {:error, atom()}
```

Checks receipt identity, status and event data, returning unfinalized inclusion.

`identity` must come from the frozen transaction. A successful result still
needs canonical-block and confirmation-depth checks by the execution layer.

## Examples

    iex> X402.AuthCapture.Receipt.check(nil, %{}, %{})
    {:error, :invalid_receipt}

# `expected_event`
*since 0.9.0* 

```elixir
@spec expected_event(
  X402.Verify.AuthCaptureEVM.verification(),
  :primary | :void_remainder
) ::
  {:ok, event()} | {:error, term()}
```

Builds the exact escrow event for a fully verified operation.

`:primary` selects the original operation. `:void_remainder` selects the
separately submitted void leg after a partial capture and uses the remaining
capturable balance, not the captured amount.

## Examples

    iex> X402.AuthCapture.Receipt.expected_event(%{})
    {:error, :invalid_verification}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
