Setup
Code
main.py
Run
Output
What happens
- Request. The payer requests the URL. A Xenarch-gated page answers HTTP 402 with an x402 version 1 body that includes
gate_id,acceptsandfacilitators. - Checks. The price is compared with
XenarchBudgetPolicy. WithXENARCH_API_TOKENset, the payer also callsPOST /v1/agent/preflighton the Xenarch API to check your caps, scope rules and pause switch. - Sign and settle. The payer signs an EIP-3009 USDC
transferWithAuthorizationfrom your wallet to the seller’s wallet and sends it to a facilitator from the gate’s list. The facilitator submits it on Base and pays the gas. - Retry. The payer requests the URL again with
X-Xenarch-Gate-IdandX-Xenarch-Tx-Hash. The seller’s integration verifies the transfer with Xenarch and returns the content.
XENARCH_API_TOKEN is not set, step 2 uses only the local budget.