# ExactAvmFacilitatorScheme

> AVM facilitator implementation for the Exact payment scheme (V2).

```python
from x402_algorand.exact import ExactAvmFacilitatorScheme  # defined as x402_algorand.exact.facilitator.ExactAvmScheme
```

```python
class ExactAvmFacilitatorScheme(signer: FacilitatorAvmSigner)
```

AVM facilitator implementation for the Exact payment scheme (V2).

Verifies and settles ASA payments on Algorand networks.

## Constructor parameters

- `signer` (`FacilitatorAvmSigner`, required):

## Attributes

- `scheme` (`Any`):
The scheme identifier ("exact").

- `caip_family` (`Any`):
The CAIP family pattern ("algorand:*").

## Examples

```python
import os

from x402_algorand import ServerAvmSigner
from x402_algorand.exact import ExactAvmFacilitatorScheme

signer = ServerAvmSigner.from_mnemonic(
    os.environ["FACILITATOR_MNEMONIC"], algod_url="http://localhost:4001", algod_token="a" * 64
)
scheme = ExactAvmFacilitatorScheme(signer)
# Usually registered with register_exact_avm_facilitator(). Called directly:
# result = scheme.verify(payload, requirements)   # VerifyResponse, never raises for a bad payment
# if result.is_valid:
#     settled = scheme.settle(payload, requirements)  # settled.transaction = buyer's payment txid
```

## Methods

### `get_extra`

```python
def get_extra(network: Network) -> dict[str, Any] | None
```

Get mechanism-specific extra data for the supported kinds endpoint.

For AVM, this includes a randomly selected fee payer address.
Random selection distributes load across multiple signers.

**Parameters**

- `network` (`Network`, required):
Network identifier (used for validation only).

**Returns**

- `returns` (`dict[str, Any] | None`):
Extra data with feePayer address, or None if no signers.

### `get_signers`

```python
def get_signers(network: Network) -> list[str]
```

Get facilitator wallet addresses.

**Parameters**

- `network` (`Network`, required):
Network identifier.

**Returns**

- `returns` (`list[str]`):
List of facilitator fee payer addresses.

### `verify`

```python
def verify(
    payload: PaymentPayload,
    requirements: PaymentRequirements,
    context: Any = None,
    *args: Any = (),
    **kwargs: Any = {},
) -> VerifyResponse
```

Verify ASA payment payload.

Validates per Algorand exact scheme spec:
1. Check paymentGroup contains 16 or fewer elements
2. Decode all transactions from the paymentGroup
3. Locate payment transaction (paymentIndex):
- Check aamt (asset amount) == requirements.amount
- Check arcv (asset receiver) matches requirements.payTo
4. If feePayer in requirements:
- Locate fee payer transaction
- Check type is "pay"
- Check close, rekey, amt are omitted/zero
- Check fee is reasonable
- Sign the transaction
5. Simulate group to verify it would succeed

Security checks:
- No unbalanced rekey operations (sandwich rekey+rekey-back allowed)
- No close-to operations allowed
- keyreg transactions blocked
- Facilitator signers cannot transfer their own funds

**Parameters**

- `payload` (`PaymentPayload`, required):
Payment payload from client.

- `requirements` (`PaymentRequirements`, required):
Payment requirements.

- `context` (`Any`, default `None`):

- `args` (`Any`, default `()`):

- `kwargs` (`Any`, default `{}`):

**Returns**

- `returns` (`VerifyResponse`):
VerifyResponse with is_valid and payer.

### `settle`

```python
def settle(
    payload: PaymentPayload,
    requirements: PaymentRequirements,
    context: Any = None,
    *args: Any = (),
    **kwargs: Any = {},
) -> SettleResponse
```

Settle ASA payment on-chain.

- Re-verifies payment
- Signs fee payer transaction
- Sends transaction group to network
- Waits for confirmation (instant finality)

**Parameters**

- `payload` (`PaymentPayload`, required):
Verified payment payload.

- `requirements` (`PaymentRequirements`, required):
Payment requirements.

- `context` (`Any`, default `None`):

- `args` (`Any`, default `()`):

- `kwargs` (`Any`, default `{}`):

**Returns**

- `returns` (`SettleResponse`):
SettleResponse with success, transaction, and payer.

Source: [x402_algorand/exact/facilitator.py](https://github.com/x402-avm/x402-algorand/blob/main/x402_algorand/exact/facilitator.py#L72)

Source: https://x402-avm.github.io/reference/python/x402-algorand/exact-avm-facilitator-scheme
