# x402 paid agent starter: Python (FastAPI)

```bash
python -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt
PAY_TO=0xYourBaseAddress NETWORK=base-sepolia uvicorn app:app --port 8403
curl -i http://localhost:8403/paid        # 402 with the payment terms
LAX_PAYER_KEY=0x... python list_offer.py  # lists lax-offer.json on LAX (0.01 USDC on Base)
pytest                                    # A1 to A5, offline
```

`create_app(price, pay_to, network, facilitator, description, work, public_url)` mirrors the TypeScript `createApp`: 402 terms, verify, settle, then the work and `X-PAYMENT-RESPONSE`. `list_offer(offer, pay, registry_url, client)` answers the registry's 402 (v2 `PAYMENT-SIGNATURE` or v1 `X-PAYMENT`) through `pay(terms)` and returns `{"id": ...}`. `evm_pay.exact_payment_header` signs the EIP-3009 authorization with a capped amount.

## Base Sepolia proof

One paid call, settled on chain through the x402.org facilitator on 21 October 2026 (20:58:41 UTC):

https://sepolia.basescan.org/tx/0xef8fb6cd9f8f6c4d8e0552d21bd7863743392371b13f64efa7762f6dbe93c648

0.01 USDC (`10000` atomic, asset `0x036CbD53842c5426634e7929541eC2318f3dCF7e`) moved from the payer 0x3c1A1E01e790Cd326495631B3b38Bd7068F08d6F to the starter's `PAY_TO` 0x9B29122f4e77Deb78bBb2580EDb07C08ff22DbA7 in block 48472260. The response was 200, with the work output and an `X-PAYMENT-RESPONSE` holding the same transaction hash.

Reproduce it:

```bash
PAY_TO=0xYourTestAddress NETWORK=base-sepolia PRICE_USDC=0.01 uvicorn app:app --port 8403   # terminal 1
PAYER_KEY=0x... URL=http://localhost:8403/paid python pay.py                               # terminal 2
```
