// 1. Create a session budget
const session = await aw.x402.createSession({
agentId: "agent_abc123",
budgetLimit: "100.00",
chain: "eip155:84532",
ttlSeconds: 3600,
allowedUrls: ["https://paid-api.example.com/v1/data"],
});
// 2. Pay for an API call
const result = await aw.x402.pay({
agentId: "agent_abc123",
targetUrl: "https://paid-api.example.com/v1/data",
sessionId: session.id,
chain: "eip155:84532",
});
// 3. Or pay using the session directly
await aw.x402.sessionPay(session.id, {
targetUrl: "https://paid-api.example.com/v1/data",
});