Agent Guide › Guides

Disclosure: this site contains referral links and MoneyTools earns a commission when you sign up or pay through them. MoneyTools also operates x402 Pay-Precheck and earns revenue from its paid calls. Nothing here is investment, financial or legal advice. Region restrictions apply (e.g. the United States) - follow each service's terms and your local law.

Pre-check an x402 seller before your agent pays

An agent that pays x402 endpoints automatically will eventually meet a seller whose 402 terms are wrong: a different network or asset than expected, a price above budget, a malformed challenge, or a payTo address on a sanctions list. This guide adds one read-only check between "found a service" and "signed a payment".

The code below only queries and compares. It never loads a private key and never pays. Payment stays in your existing x402 client.

1. What the check does

x402 Pay-Precheck fetches the target URL, parses its 402 payment requirements, and returns a verdict:

verdictmeaningsuggested policy
okpayable, no warningspay if price ≤ your budget
warnpayable, but check warningspay only if you accept the specific warnings, or ask a human
blockdo not pay (e.g. sanctions hit or invalid terms)stop
not_402the URL did not ask for paymentstop; nothing to pay

Each entry in options describes one accepted payment method with fields such as valid, network, payTo, asset, assetIsKnownUsdc, amountUsd, sanctions.hit, errors and warnings. Warnings we saw on live sellers on 2026-11-03 include v2_without_payment_required_header, eip712_name_mismatch:expected_USD_Coin and long_maxTimeoutSeconds.

Sanctions coverage, as stated in every response: OFAC SDN digital-currency addresses only - not UN/EU/UK lists. A clean result is not legal clearance.

2. Try it free

curl "https://api.moneytools.dev/demo/precheck?url=<URL-encoded endpoint you plan to pay>"

The demo is limited to 10 calls/hour/IP. In production call https://api.moneytools.dev/v1/precheck?url=… through your x402 client ($0.005 USDC on Base), or use the MCP tool x402_precheck at https://api.moneytools.dev/mcp.

3. A pay/no-pay gate in Python (stdlib only)

# From https://agent-guide.moneytools.workers.dev/guides/ (MIT). Disclosure: that site contains referral links and
# MoneyTools earns commission through them; MoneyTools also operates x402 Pay-Precheck and earns from its paid calls.
# Not investment, financial or legal advice. Region restrictions apply (e.g. United States). Read-only: no keys, no payments.
import json, urllib.parse, urllib.request

UA = {"User-Agent": "my-agent/1.0 (+https://example.org/contact)"}  # default Python-urllib UA gets HTTP 403

# Free demo (10 calls/hour/IP). In production call /v1/precheck ($0.005 via x402).
PRECHECK = "https://x402-pay-precheck.moneytools.workers.dev/demo/precheck"

def precheck(target_url):
    q = urllib.parse.urlencode({"url": target_url})
    with urllib.request.urlopen(urllib.request.Request(f"{PRECHECK}?{q}", headers=UA), timeout=30) as r:
        return json.load(r)

def should_pay(target_url, max_usd, allow_warn=False):
    """Return (decision, report). Read-only: no keys, no payment."""
    r = precheck(target_url)
    if r["verdict"] == "ok" or (allow_warn and r["verdict"] == "warn"):
        options = [o for o in r["options"]
                   if o["valid"] and not o["sanctions"]["hit"]
                   and float(o["amountUsd"]) <= max_usd]
        return bool(options), {"verdict": r["verdict"], "options": options,
                               "warnings": r["warnings"]}
    return False, {"verdict": r["verdict"], "summary": r["summary"],
                   "reasons": r["reasons"]}

if __name__ == "__main__":
    import sys
    ok, report = should_pay(sys.argv[1], max_usd=float(sys.argv[2]))
    print("PAY" if ok else "DO NOT PAY", json.dumps(report, indent=2)[:800])

Download: precheck_gate.py. Run: python3 precheck_gate.py "<endpoint>" 0.01. Note: send your own User-Agent; requests with Python's default Python-urllib agent got HTTP 403 when we tested.

4. After paying: verify settlement

Your client gets a transaction hash. https://api.moneytools.dev/v1/verify?txHash=<0x..>&network=base&payTo=<0x..>&amount=<decimal> ($0.003) returns valid|invalid|pending|not_found from public RPC.

Building a router or agent framework?

Pay-Precheck pays referrers 20% of net revenue on paid calls you route with ref=<your Base wallet>. Terms, the minimum payout and the self-referral rule are on the referral page. This is a commission program run by MoneyTools; not investment advice.


Disclosure: this site contains referral links and MoneyTools earns a commission when you sign up or pay through them. MoneyTools also operates x402 Pay-Precheck and earns revenue from its paid calls. Nothing here is investment, financial or legal advice. Region restrictions apply (e.g. the United States) - follow each service's terms and your local law. Last updated 2026-11-03.