A2A Logo Watermark
A2A Logo Watermark
A2A Logo Watermark
A2A X402 Logo

Documentation

Complete guide to A2A X402 development

Getting Started


Getting Started with A2A X402


A2A (Agent-to-Agent) X402 is a revolutionary payment protocol built on Solana that enables seamless, autonomous transactions between AI agents.


What is A2A X402?


A2A X402 combines the HTTP 402 Payment Required status code with Solana's high-performance blockchain to create a standardized way for AI agents to automatically handle payment transactions.


Key Features


  • **Instant Payments**: Sub-second transaction processing on Solana
  • **AI-Native**: Designed specifically for AI agent interactions
  • **Low Fees**: Minimal transaction costs on Solana network
  • **Developer Friendly**: Simple SDK and comprehensive tooling
  • **Secure**: Built-in security features and audit trails

  • Quick Installation


    bash
    # Install the A2A SDK
    npm install @a2a/x402-sdk
    
    # Or using yarn
    yarn add @a2a/x402-sdk

    Install the A2A SDK

    npm install @a2a/x402-sdk


    Or using yarn

    yarn add @a2a/x402-sdk


    Your First A2A Payment


    javascript
    import { A2AClient } from '@a2a/X402-sdk'
    
    // Initialize client
    const client = new A2AClient({
      network: 'devnet', // or 'mainnet'
      privateKey: process.env.SOLANA_PRIVATE_KEY
    })
    
    // Create a payment
    const payment = await client.createPayment({
      recipient: 'Bs7D8zq7cKk5J4vN8fK2X9gH3pL6mR4eT8wQ5sA9cB2x',
      amount: 0.01, // SOL
      memo: 'AI service payment'
    })
    
    console.log('Payment ID:', payment.signature)

    import { A2AClient } from '@a2a/X402-sdk'


    // Initialize client

    const client = new A2AClient({

    network: 'devnet', // or 'mainnet'

    privateKey: process.env.SOLANA_PRIVATE_KEY

    })


    // Create a payment

    const payment = await client.createPayment({

    recipient: 'Bs7D8zq7cKk5J4vN8fK2X9gH3pL6mR4eT8wQ5sA9cB2x',

    amount: 0.01, // SOL

    memo: 'AI service payment'

    })


    console.log('Payment ID:', payment.signature)