Install
openclaw skills install @marketingkioldenburg/x402-clientx402 payment client for AI agents — how to automatically respond to HTTP 402 challenges, pay via CDP/Permit2, retry with PAYMENT-SIGNATURE, and settle the full x402 flow. For consuming pay-per-request APIs without API keys or subscriptions.
openclaw skills install @marketingkioldenburg/x402-clientHow to consume x402-enabled APIs: when a server returns HTTP 402 PAYMENT-REQUIRED, pay the exact amount and retry with the payment signature.
x402 is a payments protocol for the internet built on HTTP. It lets agents pay per request with USDC on Base (eip155:8453), no API keys, no subscriptions, no human in the loop.
Flow:
curl -s -X POST https://api.example.com/services/your-service/jobs \
-H "Content-Type: application/json" \
-d '{"url": "https://example.de"}'
Expected response (HTTP 402):
{
"x402Version": 2,
"error": "PAYMENT-SIGNATURE header is required",
"resource": {"url": "https://api.example.com/services/your-service/jobs"},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "50000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x1c8b3C34Dca2Ba2A71598f1F9E0BC2a04A0Bea36",
"maxTimeoutSeconds": 3600,
"extra": {"name": "USD Coin", "version": "2", "priceUsdc": "0.05"}
}
]
}
Amounts are in atomic units (6 decimals for USDC): amount: "50000" = $0.05.
Send amount microunits of asset (USDC) on network (Base) to payTo from your agent wallet.
Ways to pay:
cdp wallet transfer with USDCSave the transaction hash — it becomes your PAYMENT-SIGNATURE.
curl -s -X POST https://api.example.com/services/your-service/jobs \
-H "Content-Type: application/json" \
-H "PAYMENT-SIGNATURE: 0x<tx_hash>" \
-d '{"url": "https://example.de"}'
The server verifies the tx hash via its facilitator (e.g. CDP /verify then /settle), confirms the exact amount and payTo match, then queues or returns the result.
Some services return the result directly in the retry response. Others queue a job:
curl -s https://api.example.com/services/your-service/jobs/<job_id>/result
Never blindly retry a failed payment call — you can pay twice:
Before paying, check the service's machine-readable manifest:
https://service.example/.well-known/x402 or /.well-known/x402.jsonhttps://service.example/llms.txthttps://service.example/promo/catalog.jsonThese list all endpoints, prices (in USDC), payTo addresses, and input schemas — so you know the price before triggering the 402.
maxTimeoutSeconds — some services run async jobs after settlement