📖 Documentation Menu

Integrations

AgentCash Integration

DRIP uses AgentCash to handle x402 payments — the protocol that lets AI agents pay for data programmatically using USDC on Solana.

What Is x402?

x402 is a payment protocol built on HTTP status code 402 Payment Required. Instead of API keys and subscription tiers, services return a 402 response with payment instructions. The client pays on-chain and retries with proof.

  • No API keys — payment is the authentication
  • No subscriptions — pay exactly for what you use
  • No rate limits — if you can pay, you can query
  • Agent-native — AI agents can pay for resources autonomously

Payment Flow

Every DRIP API request follows this flow:

  1. Client sends a request to a DRIP endpoint.
  2. Server responds with 402 Payment Required containing: amount, recipient wallet, token (USDC), and a payment nonce.
  3. Client signs and submits a Solana transaction for the specified amount.
  4. Client retries the original request with an X-Payment-Proof header containing the transaction signature.
  5. Server verifies the payment on-chain and returns data.
402 Response Body
{
  "error": "payment_required",
  "payment": {
    "amount": "0.05",
    "token": "USDC",
    "recipient": "DRiPxxx...xxx",
    "network": "solana",
    "nonce": "abc123"
  }
}

Integration Guide

If you're building on top of DRIP and want to handle x402 payments programmatically:

Using the SDK (recommended)

Automatic x402 handling
import { Drip } from "@drip/sdk";

// The SDK handles the 402 flow automatically
const drip = new Drip({ wallet: "<your-solana-keypair>" });
const result = await drip.research("anthropic.com");
// Payment was signed, submitted, and verified behind the scenes

Manual x402 flow

Manual implementation
// 1. Make initial request
const res = await fetch("https://api.drip.surf/research?domain=anthropic.com");

if (res.status === 402) {
  const { payment } = await res.json();

  // 2. Submit Solana payment
  const txSig = await submitPayment({
    amount: payment.amount,
    token: payment.token,
    recipient: payment.recipient,
  });

  // 3. Retry with proof
  const data = await fetch(
    "https://api.drip.surf/research?domain=anthropic.com",
    { headers: { "X-Payment-Proof": txSig } }
  );

  return data.json();
}
AgentCash makes DRIP agent-native — any AI agent with a Solana wallet can use DRIP without human intervention. The payment flow is fully programmatic.