Prerequisites
- A crypto wallet funded with USDC (EVM or Solana supported by Coinbase x402)
- Node.js + npm or Python + pip
- Access to the Horizon base URL (
https://api.horizon.new/v1) - Familiarity with Coinbase’s Quickstart for buyers
Step 1 — Install x402 client helpers
- Node.js
- Python
Install one of Coinbase’s helper packages so 402 challenges are handled automatically:
Step 2 — Instantiate a wallet client
Create a signer that can authorise onchain payments.
Coinbase Server Wallet
Coinbase Server Wallet
-
Export credentials:
-
Install dependencies:
-
Instantiate the wallet client:
- Node.js
- Python
Privy embedded wallets
Privy embedded wallets
-
Install Privy’s Node SDK:
-
Instantiate the client using the app credentials from your Privy dashboard:
-
Create an embedded wallet and capture its
idfor future requests:- Ethereum
- Solana
-
When you need to fund jobs or replay invoices, use Privy helpers to sign transactions:
Review Privy’s wallet quickstart for end-user provisioning and transaction helpers.
Dynamic MPC wallets
Dynamic MPC wallets
-
Install Dynamic’s Node SDK:
-
Configure the client with your Dynamic environment ID and server token:
-
Create an MPC wallet on the chain you plan to use for x402 settlements:
- EVM (Base Sepolia)
- Solana
-
Use Dynamic’s helpers to sign and send payments when replaying
402invoices:
Enable embedded wallets and target chains in the Dynamic dashboard so wallets can transact immediately.
Bring your own EVM wallet
Bring your own EVM wallet
- Node.js (viem)
- Python (eth-account)
Bring your own Solana wallet
Bring your own Solana wallet
Step 3 — Wrap your HTTP client to auto-pay
The helper packages intercept402 Payment Required responses, sign the invoice, and replay the request for you.
- Node.js (x402-fetch)
- Node.js (x402-axios)
- Python (HTTPX)
- Python (Requests)
Step 4 — Call Horizon endpoints
Once your HTTP client auto-replays paid requests, you can hit any Horizon endpoint directly. The helper packages take care ofX-PAYMENT headers; you only need to focus on request bodies.
Discovery — synchronous search
Discovery — synchronous search
Generation — async text job
Generation — async text job
Extraction — upload a PDF
Extraction — upload a PDF
Optional — Discover services dynamically
Leverage the x402 Bazaar when you want code to discover available services instead of hardcoding endpoints. See Coinbase’s Bazaar documentation and the example clients for Node.js and Python.Where to go next
Call the API
Reference quick snippets for discovery, generation, extraction, uploads, and job polling.
Master webhooks
Subscribe to async completions, failures, and intermediate results.
Explore the API
Review endpoint-specific schemas and 402 behaviour.
Configure environments
Align payment settings, retention, and rate limits across environments.
