Overview

Learn what Vanta SDK is and how it enables native HTTP 402 payments for your APIs and applications.

What is Vanta SDK?

Vanta SDK is a complete toolkit for implementing x402 payments—a protocol that enables native payment flows directly within HTTP requests and responses. Instead of integrating with payment processors, managing subscriptions, or building custom billing infrastructure, Vanta SDK lets you accept programmatic payments at the protocol level.

When a client requests a protected resource without paying, your server responds with HTTP 402 Payment Required and a payment challenge. The client completes the payment on-chain, retries the request with proof, and receives the resource. It's that simple.

Why x402?

HTTP 402 Payment Required has been a reserved status code since 1999, waiting for a practical implementation. With blockchain technology, we finally have the infrastructure for trustless, programmable payments that x402 needs.

Key benefits of the x402 approach:

  • No intermediaries: Payments go directly from client to server wallet
  • No API keys: Payment proof serves as authentication
  • No subscriptions: Pay-per-use model scales naturally
  • Programmable: AI agents can autonomously pay for API access
  • Instant settlement: No waiting for payment processor settlements

Use Cases

Vanta SDK excels in scenarios where traditional payment models fall short:

AI Agents and Autonomous Systems

AI agents need to access APIs, data feeds, and compute resources without human intervention. With Vanta, agents can programmatically pay for exactly what they need, when they need it, with built-in budget controls and usage caps.

API Monetization

Turn any API endpoint into a revenue stream with pay-per-request pricing. No need to manage API keys, rate limit free users, or build subscription tiers. Users pay only for what they consume.

Micropayment Content

Gate premium content, research papers, or data behind micropayments. Users unlock individual pieces of content without committing to a subscription.

Usage-Based Billing

Build services with per-token, per-byte, or per-compute-second pricing. The SDK handles quota management, usage tracking, and automatic recharging.

Architecture Overview

Vanta SDK consists of three main components:

  • Server Middleware (@vanta/middleware): Express, Next.js, Fastify, and framework-agnostic middleware that handles payment challenges, verification, and token issuance.
  • Client SDK (@vanta/client): Browser and Node.js clients that automatically handle 402 responses, execute payments, and cache access tokens.
  • Core Library (@vanta/sdk): Shared types, utilities, and cryptographic primitives used by both client and server packages.

Framework Support

Vanta SDK has first-class support for Express, Next.js, Fastify, and Hono. Framework-agnostic adapters are also available for custom setups.

Supported Networks

Vanta SDK supports payments on multiple EVM-compatible networks:

  • Base: Low fees, fast finality, ideal for micropayments
  • Ethereum: Maximum security, higher fees
  • Optimism: Low fees, Ethereum security
  • Arbitrum: Low fees, high throughput
  • Polygon: Very low fees, wide adoption

The client SDK automatically detects the required network from the payment challenge and prompts the user to switch if needed.

Getting Started

Ready to integrate Vanta SDK? Here's the recommended path:

  1. Installation - Install the packages you need
  2. Quick Start - Build your first payment-protected endpoint
  3. Core Concepts - Understand how x402 works
  4. Recipes - Framework-specific integration guides

Join the Community

Have questions? Join our Discord community or check out the GitHub repository.