Gear-JSGear-JS tools

X402 Protocol

Vara Network supports the [X402 payment protocol](https://www. x402.

Vara Network supports the X402 payment protocol, enabling developers to build monetizable APIs and services with seamless micropayments.

Overview

X402 is an open standard for HTTP-based payments developed by Coinbase. It uses the HTTP 402 "Payment Required" status code to enable pay-per-request API access, content paywalls, and agentic commerce.

When a client requests a paid resource, the server responds with a 402 status and payment details. The client then includes payment information via the X-PAYMENT header in subsequent requests.

Key Features

  • Native token support — accepts both VARA and VFT (Vara Fungible Tokens)
  • Framework integrations — ready-to-use middleware for Express.js, Next.js, and Axios interceptors
  • Low-cost micropayments — Vara's sub-second block times and minimal fees make per-request payments practical
  • Protocol compliance — full compatibility with the X402 specification

How It Works

  1. Client requests a resource from a server
  2. Server responds with 402 Payment Required and payment instructions
  3. Client prepares and submits a payment payload
  4. Server verifies payment via the x402 facilitator's /verify and /settle endpoints
  5. Upon successful verification, server provides the requested resource

The facilitator handles payment verification and on-chain settlement, so developers don't need direct blockchain infrastructure.

Use Cases

  • API monetization — charge per request for AI/ML inference, data feeds, oracles, or computational services
  • Content paywalls — direct payments to content creators without intermediaries
  • Agentic commerce — enable AI agents to pay for API calls, data queries, and services autonomously

Resources

ResourceLink
x402-vara PackageGitHub
Next.js Demo ExampleGitHub
X402 Protocol Specificationx402.org
More details and AnnouncementX Post

On this page