Setup
You need a site token from the Xenarch dashboard and the site domain set on the platform. See Set the site domain once..env:
Code
main.py
This app uses both patterns to show them side by side. The middleware also covers
/premium, so a bot is charged there before the decorator runs. In a real app, use one pattern per route.Run
Test
Response examples
Free route:payTo and seller_wallet are your receiving wallet. The agent signs an EIP-3009 USDC authorization to that address, a facilitator from the list submits it on Base and pays the gas, and the agent retries with the gate id and transaction hash.
AI bot after payment: