OpenClaw x402-Layer Skill
The x402-layer skill enables OpenClaw agents to interact with x402 Singularity Layer for autonomous API monetization and consumption.This skill is production-ready and has been tested with real payments on Base (EVM) and Solana, including the current PayAI-backed Solana flow.
Current release: v1.9.1. This release hardens the XMTP helper, adds explicit World AgentKit and XMTP support runbooks, and keeps optional Singularity MCP guidance in the same install surface.
Script Source Code
The full Python source code for all scripts is available in this repository: View Scripts Folder- Consumer Mode
- Provider Mode
- Agent Registry
Scripts for buying services from the marketplace:
| Script | Purpose | Source |
|---|---|---|
pay_base.py | Pay for endpoints on Base (recommended default) | View Code |
pay_solana.py | Pay for endpoints on Solana with the sponsored PayAI flow | View Code |
consume_credits.py | Use pre-purchased credits (fastest) | View Code |
consume_product.py | Purchase digital products (files) | View Code |
check_credits.py | Check your credit balance | View Code |
recharge_credits.py | Buy credit packs for an endpoint | View Code |
discover_marketplace.py | Browse available services | View Code |
Quick Start
Installation
Install directly via our self-hosted endpoint:Environment Setup
World AgentKit Benefits
XMTP Support Threads
Usage Examples
Integrate Payments Into Your App
Pay for an Endpoint (Consumer)
Use Credits (Fastest)
Create Your Own Endpoint (Provider)
Note: Save the API Key from the output and use it to secure your origin server.
Security: API Key Verification
[!IMPORTANT] When you create an endpoint, x402 acts as a proxy to your origin server. You MUST verify requests are coming from x402.
- Get your API Key: Returned when you run
create_endpoint.py. - Verify Headers: Your origin server MUST check for this header in every request:
If the header is missing or incorrect, reject the request (401 Unauthorized).
Browse Marketplace
Register an Agent (Wallet-First)
register_agent.pyrequests a one-time challenge fromPOST /agent/auth/challenge- Your wallet signs the challenge locally
- The script exchanges that signature at
POST /agent/auth/verify - The worker returns a short-lived session token
list_my_endpoints.pyandlist_agents.pyuse wallet-authenticatedGET /agent/erc8004/endpoints/mineandGET /agent/erc8004/mine- The same wallet sends the real on-chain transaction via prepare/finalize routes
update_agent.pyusesupdate/prepareplusupdate/finalize, and automatically sends the on-chain URI update transaction when metadata changes
Technical Details
Base (EVM) Payments
Uses EIP-712TransferWithAuthorization signatures:
- Gasless for the payer
- Facilitator settles on-chain
- Simplest production default
Solana Payments
UsesVersionedTransaction with MessageV0:
- Facilitator pays gas fees
- SPL Token
TransferCheckedinstruction - Must include the live
feePayerfrom the challenge - Exact-payment payload must stay within facilitator compute limits
- The bundled signer handles the current live flow
Skill Metadata
| Field | Value |
|---|---|
| Slug | x402-layer |
| Version | 1.9.1 |
| Networks | Base, Ethereum, Polygon, BSC, Monad, Solana |
| Currency | USDC |
Resources
Changelog
v1.9.1
- hardened
xmtp_support.mjsby removing the environment-driven Studio base override from the helper itself - added explicit runbooks for World AgentKit benefits and XMTP support thread operations
- refreshed stale example versions and kept MCP guidance in the same install surface
v1.8.2
- removed globally-required secret env declarations from skill metadata
- documented capability-specific environment requirements so users expose only the vars needed for the current task
- synced the safer environment guidance across the hosted skill and public docs
v1.8.1
- fixed direct Base endpoint payments for skill usage by rejecting self-payment early
- aligned
pay_base.pywith the hosted purchase-path shape using?action=purchase
v1.8.0
- Added seller-side endpoint configuration parity for best-fit audience and verified human-backed AgentKit benefit fields
- Added real
manage_endpoint.py updatesupport against worker PATCH routes
v1.7.0
- Added wallet-signed support APIs for agent wallets
- Added support thread commands and XMTP helper flows for agent-side support operations
- Preserved AgentKit-aware discovery and optional Base payment flow for verified human-backed agent wallets
v1.5.0
- Added a first-class payments integration path for agents using direct endpoints, credits, products, webhooks, and receipt verification
- Added
payments-integration.mdas the decision guide for payment shape and fulfillment strategy - Fixed the bundled Solana signer to match the live PayAI-backed compute limit requirement
v1.4.0
- Wallet-first ERC-8004 / Solana-8004 registration is now the default for
register_agent.py - Added signed challenge + short-lived agent session flow for API-only wallet auth
- Added
list_my_endpoints.py,list_agents.py, andupdate_agent.pyfor full post-registration lifecycle management - Registration now supports version, tags, platform endpoint bindings, and custom endpoint URLs
- Removed the legacy x402-paid worker registration path; wallet-first registration is now the only supported agent flow
v1.0.1
- New Script:
consume_product.py- Purchase and download digital products
v1.0.0
Initial release with full x402 Agentic Access API integration: Provider Mode:- Deploy monetized endpoints with automatic wallet-to-wallet profit routing
- Top up credits programmatically
- List endpoints on public marketplace
- Marketplace discovery with filtering
- Pay-per-request with EIP-712 permits (Base) and VersionedTransaction (Solana)
- Credit-based access for zero-latency consumption
