PonponPay

x402 Agent Payments

Protect APIs, digital goods, and agent-accessible resources with standard x402 exact payments. Agents receive HTTP 402, sign a USDC authorization, and PonponPay verifies, locks the nonce, and submits settlement on-chain.

Integration

x402 must run server-side with API Key mode. Never expose API Keys or x402 settlement code in browser bundles.

import { ponponpayX402 } from '@ponponpay/sdk/x402';

const x402 = ponponpayX402({
  apiKey: process.env.PONPONPAY_API_KEY!,
  resource: {
    resource: 'https://merchant.example.com/api/premium-data',
    method: 'GET',
    price: '$0.01',
    maxAmountRequired: '10000',
    network: 'eip155:8453',
    asset: 'USDC',
    payTo: '0xYourMerchantSettlementWallet',
    description: 'Premium market data'
  }
});

export async function GET(request: Request) {
  const result = await x402.verifyAndSettle(request);
  if (!result.paid) {
    return result.required();
  }

  return Response.json({ data: 'premium payload' });
}

Supported Networks

Current support is limited to the standard EVM exact flow using Circle USDC transferWithAuthorization.

NetworkCAIP-2USDC Contract
Baseeip155:84530x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Ethereumeip155:10xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Polygoneip155:1370x3c499c542cef5e3811e1192ce70d8cc03d5c3359

Validation Rules

  • The scheme must be exact.
  • network, asset, assetContract, payTo, and amount must match the resource requirement.
  • resource URL and HTTP method are bound to the current request and must match.
  • validAfter / validBefore must be within the allowed window, and each nonce can settle only once.
  • The EIP-712 signature must recover authorization.from.

Unsupported Chains

BSC, Tron, Solana, TON, and BTC are not part of the current standard EVM exact flow. Supporting them later requires a separate x402 scheme or PonponPay extension.