Skip to main content

Quickstart Guide

Get your AI agent making autonomous payments in under 5 minutes with this streamlined approach.

Step 1: Register Your Agent

Every PayStabl-powered agent gets a smart wallet, an onchain identity, and customizable spending policies.

Create Agent Identity

Go to paystabl.com and signup to register your AI agent.

Once registered, PayStabl will generate:

  • A CDP wallet address for your agent
  • A secure agent_token (OAuth Bearer token)

This agent_token is used to authenticate your agent when calling PayStabl tools from different frameworks (MCP, LangGraph, ACP, etc.). You can store it in your config file or pass it via headers during runtime.

Configure Agent Policies

Set up spending rules and domain restrictions to control your agent's behavior:

await PayStabl.configurePolicies(agent.id, {
dailyLimit: "10.00", // Max $10 per day
perCallLimit: "1.00", // Max $1 per transaction
allowedDomains: [ // Restrict to trusted APIs
"api.weatherapi.com",
"premium-data.io"
],
requireApproval: { // Require approval for large amounts
threshold: "5.00"
},
sessionDuration: "24h" // How long agent can operate without re-auth
});

Fund Your Agent Wallet

For testnet development, get free tokens to fund your agent's operations or visit the Base Sepolia Faucet directly.

Step 2: Framework Integration

Use PayStabl with your preferred AI Protocol or frameworks - MCP, A2A, LangGraph, N8N, and more.

MCP Server Integration

PayStabl MCP Server

// Configure Claude to use PayStabl tools
{
"mcpServers": {
"paystabl": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.paystabl.com/mcp",
"--header", "Authorization:Bearer <your-agent-token>",
"--transport", "http-only"
],
"env": {}
}
}
}

LangGraph Integration (coming soon)

from paystabl import PayStablNode

# Add payment capabilities to your LangGraph workflow
def create_payment_workflow():
workflow = StateGraph()

# Add PayStabl payment node
workflow.add_node("payment", PayStablNode(
agent_id="my-weather-agent"
))

return workflow

N8N (coming soon)

Use PayStabl as a connector node for paid APIs, subscriptions, and webhooks directly in no-code workflows.

ACP-Compatible PayStabl Agents (coming soon)

We’re launching two fully Agent Communication Protocol native agents:

  1. AgentPay – an agent that pays other agents on your behalf
  2. WrapAgent – generates monetized ACP agents for your API or service

Step 3: Let Agents Operate Onchain

Once registered and integrated, your agents can autonomously handle payments for APIs, services, and inter-agent transactions.

Pay for Premium APIs

Your agent can automatically pay for premium data and services:

// Agent pays for weather API access
const weatherData = await agent.pay_api_endpoint({
url: "https://api.weatherapi.com/v1/premium?q=London",
agentId: "my-weather-agent"
});

console.log("Weather data:", weatherData.response);
console.log("Payment receipt:", weatherData.receipt);

Subscribe to Services

Set up recurring payments for subscription-based services:

// Subscribe to premium data feed
await agent.createSubscription({
provider: "premium-data.io",
plan: "real-time-updates",
frequency: "monthly",
amount: "9.99"
});

Agent-to-Agent Payments

Enable agents to pay each other for services:

// Weather agent pays summarization agent
await agent.pay_agent({
fromAgentId: "my-weather-agent",
toAgentId: "summarization-agent",
amount: "0.25",
purpose: "Weather summary generation",
data: { weatherReport: "..." }
});

Handle x402 Payment Required

Agents automatically handle HTTP 402 Payment Required responses:

// Agent encounters paywall and automatically pays
try {
const response = await fetch("https://premium-api.com/data");

if (response.status === 402) {
// PayStabl automatically handles payment and retries
const paidResponse = await agent.handlePaymentRequired(response);
return paidResponse.json();
}
} catch (error) {
console.log("Payment handled automatically:", error.receipt);
}

Monitoring Agent Operations

View Transaction History

// Get recent transactions for your agent
const transactions = await PayStabl.getTransactions({
agentId: "my-weather-agent",
limit: 10,
status: "completed"
});

transactions.forEach(tx => {
console.log(`${tx.timestamp}: ${tx.amount} to ${tx.recipient}`);
console.log(`Purpose: ${tx.purpose}`);
});

Check Agent Balance

const balance = await PayStabl.getAgentBalance("my-weather-agent");
console.log(`Agent balance: ${balance.eth} ETH`);
console.log(`USD equivalent: $${balance.usd}`);
console.log(`Available for spending: $${balance.available}`);

Real-time Activity Monitoring

// Subscribe to agent payment events
PayStabl.onPayment("my-weather-agent", (event) => {
console.log(`Payment: ${event.amount} to ${event.recipient}`);
console.log(`Remaining budget: ${event.remainingDailyLimit}`);
});

Common Use Cases

Autonomous Research Agent

// Agent that pays for multiple data sources
const researchAgent = await PayStabl.registerAgent({
name: "research-agent",
policies: {
dailyLimit: "50.00",
allowedDomains: ["academic-api.com", "news-api.org", "data-provider.net"]
}
});

Multi-Agent Marketplace

// Agents providing and consuming services
const serviceProvider = await PayStabl.registerAgent({
name: "translation-service",
capabilities: ["translate", "summarize"]
});

const serviceConsumer = await PayStabl.registerAgent({
name: "content-creator",
budget: "100.00"
});

Next Steps

Your agent is now ready to operate autonomously onchain! Explore these resources:

  1. Framework Integrations - Deep dive into MCP, LangGraph, CrewAI integrations
  2. Payment Tools - Learn all available payment functions
  3. Security Guide - Implement production-ready security policies
  4. Architecture - Understand how PayStabl works under the hood

Troubleshooting

Common Issues

"Agent not registered" error

  • Verify your agent ID is correct
  • Check that registration completed successfully
  • Ensure you're using the right network (mainnet vs testnet)

"Insufficient funds" error

  • Check your agent's balance with PayStabl.getAgentBalance()
  • Fund your wallet using the testnet faucet
  • Verify policy limits aren't blocking the transaction

"Policy violation" error

  • Review your agent's spending limits and allowlists
  • Check if the target API domain is approved
  • Verify the transaction amount is within configured limits

Getting Help

Ready to build autonomous payment flows? Explore our framework integrations to get started with your preferred AI development stack.