Embed Rich Metadata Into Every x402 Transaction
Automatically attach invoice IDs, agent identifiers, and service descriptions to every payment — visible on-chain in Solscan, BscScan, and Etherscan. Give your agents financial memory across sessions while maintaining complete audit trails.
View IntegrationAgents need to understand their spending history to operate effectively across sessions
When your agent restarts, it has no memory of what it paid for yesterday. x402ledger gives agents a complete history of purchases, so they know what services they've used and why.
Agents can query their payment history to avoid duplicate purchases, understand which services performed well, and optimize spending patterns over time.
Your agents stay organized with full transaction context, while you get automatic invoices, budget controls, and audit trails for compliance.
Drop in our SDK and instantly get enterprise-grade financial tracking for x402 payments
Every x402 payment generates a detailed invoice with transaction metadata and context.
See what your agents are spending in real-time with live updates and visual analytics.
Set spending limits per agent, per day, or per month to prevent budget overruns.
Complete transaction history for compliance, accounting, and financial reporting.
One npm command. Works with Solana, Ethereum, and BNB Chain.
Add x402ledger around your payment calls. All tracking happens automatically.
See real-time spending, download invoices, and export to your accounting system.
Every payment is automatically tagged with invoice metadata visible on blockchain explorers
All transaction metadata is permanently stored on-chain. Invoice IDs, agent information, and service descriptions are visible in blockchain explorers - making it easy to verify, audit, and export for accounting.
Copy, paste, and start tracking x402 payments in minutes
Install the SDK:
npm install @x402ledger/sdk
import { x402ledger } from '@x402ledger/sdk';
import { Connection, PublicKey } from '@solana/web3.js';
// Initialize x402ledger
const ledger = new x402ledger({
apiKey: 'your-api-key',
chain: 'solana',
network: 'mainnet-beta'
});
// Track a payment
const connection = new Connection('https://api.mainnet-beta.solana.com');
async function makeTrackedPayment() {
const payment = await ledger.trackPayment({
agentId: 'agent-001',
recipient: new PublicKey('7xKXt...'),
amount: 0.1,
token: 'SOL',
metadata: {
service: 'API Request',
description: 'GPT-4 inference'
}
});
// Invoice automatically generated!
console.log('Invoice ID:', payment.invoiceId);
}
import { x402ledger } from '@x402ledger/sdk';
import { ethers } from 'ethers';
// Initialize x402ledger for BNB Chain
const ledger = new x402ledger({
apiKey: 'your-api-key',
chain: 'bnb',
network: 'mainnet'
});
// Set up provider
const provider = new ethers.providers.JsonRpcProvider(
'https://bsc-dataseed.binance.org'
);
async function makeTrackedPayment() {
const payment = await ledger.trackPayment({
agentId: 'agent-002',
recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '0.05',
token: 'BNB',
metadata: {
service: 'Data Processing',
description: 'Vector embeddings generation'
}
});
// Budget controls and alerts included
console.log('Invoice ID:', payment.invoiceId);
console.log('Remaining budget:', payment.remainingBudget);
}
import { x402ledger } from '@x402ledger/sdk';
import { ethers } from 'ethers';
// Initialize x402ledger for Ethereum
const ledger = new x402ledger({
apiKey: 'your-api-key',
chain: 'ethereum',
network: 'mainnet'
});
// Set up provider
const provider = new ethers.providers.JsonRpcProvider(
'https://mainnet.infura.io/v3/YOUR-PROJECT-ID'
);
async function makeTrackedPayment() {
const payment = await ledger.trackPayment({
agentId: 'agent-003',
recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: ethers.utils.parseEther('0.01'),
token: 'ETH',
metadata: {
service: 'Storage',
description: 'IPFS pinning service'
}
});
// Real-time dashboard updates automatically
console.log('Invoice ID:', payment.invoiceId);
console.log('Transaction hash:', payment.txHash);
}