Go Implementation¶
Welcome to the OpenLibx402 Go implementation documentation. This section covers all Go packages, libraries, middleware, and examples for building X402-enabled APIs and clients.
Overview¶
The Go implementation provides:
- Core Library - X402 protocol implementation with models, errors, and Solana payment processing
- Client Library - HTTP client with automatic and explicit payment handling
- Middleware - Integration with popular Go web frameworks (net/http, Echo)
- Examples - Complete working examples for server and client implementations
Quick Navigation¶
📚 Libraries¶
- Core Library - Payment models, errors, and Solana processor
- Client Library - X402 HTTP client with auto-payment support
🔗 Middleware¶
- net/http Middleware - Standard Go net/http integration
- Echo Middleware - Echo web framework integration
🚀 Examples¶
- net/http Server - Complete server with multiple pricing tiers
- Echo Server - Echo framework server with dynamic pricing
📖 Getting Started¶
🔧 Reference¶
Key Features¶
✨ One-Line Integration - Add payment requirements with minimal code 🤖 Automatic Payments - Clients automatically handle payment flows ⚡ Instant Settlement - ~200ms on Solana 💰 Micropayments - Support payments as low as $0.001 🔐 Secure - SSRF protection, payment verification, nonce-based replay protection 🌐 Framework Agnostic - Works with net/http, Echo, and custom implementations
Import Paths¶
Installation¶
The X402 Flow¶
Support¶
For issues, questions, or contributions: - GitHub Issues - GitHub Discussions - X402 Protocol
Next Steps¶
Start with the Installation guide and choose your path:
- Building a Server? → Server Quick Start
- Building a Client? → Client Quick Start
- Need Details? → API Reference