Stellar x402 Ecosystem

Complete Stellar implementation of the x402 payment protocol.
"1 line of code to accept digital dollars on Stellar. No fees, 2-second settlement, $0.001 minimum payment."
License: MITNode.js

What is x402?

The x402 payment protocol is an open standard for internet-native payments that leverages the existing 402 Payment Required HTTP status code. It enables:

  • Chain-agnostic payments - Works across different blockchains
  • Gasless for clients - Facilitators can sponsor transaction fees
  • Minimal integration - 1 line for servers, 1 function for clients
  • Low minimums - Support for micropayments ($0.001+)
  • Fast settlement - 2-5 second confirmation times

What Makes Stellar x402 Different?

This implementation brings x402 to the Stellar network, offering unique advantages:

🚀 Ultra-Fast Settlement

  • 2-5 second confirmation - Near-instant finality
  • Ledger-based expiry - More precise than timestamps
  • No gas wars - Fixed, predictable fees

💰 True Gasless Payments

  • Fee sponsorship - Via fee-bump transactions
  • Trust-minimized - Client signatures preserved
  • Flexible - Works with or without sponsorship

🔐 Native Stellar Features

  • XDR format - Native transaction serialization
  • Replay protection - Protocol-level sequence numbers
  • Native XLM - No token contracts needed
  • Soroban ready - Support for smart contracts

🌐 Browser-First

  • Freighter integration - Seamless signing
  • Beautiful UI - Pre-built paywalls
  • No RPC needed - Client-side simplicity

Key Features

🔒 Security

  • • Trust-minimized architecture
  • • Redis-backed replay protection
  • • Idempotency & caching
  • • Full Zod validation

⚡ Performance

  • • 2-5 second settlement
  • • Optional fee sponsorship
  • • Efficient verification
  • • Response buffering

🎨 Experience

  • • TypeScript first
  • • Modular packages
  • • Pre-built paywall UI
  • • Comprehensive examples

🌍 Ecosystem

  • • Freighter wallet integration
  • • Express middleware
  • • Fetch wrapper
  • • Discovery API

Comparison with Other x402 Implementations

FeatureEVM (Coinbase)Stellar (Ours)
Transaction FormatSignature-basedXDR (signed transaction)
Fee SponsorshipMeta-transactionsFee-bump transactions
Settlement Time~12 seconds2-5 seconds
Expiry MechanismTimestamp (validBefore)Ledger sequence
Native AssetRequires ERC-20Native XLM
Replay ProtectionNonce-basedSequence numbers
Browser WalletMetaMaskFreighter

Network Support

  • Stellar Testnet (stellar-testnet)
  • 🚧Stellar Mainnet (stellar-mainnet) - Coming soon

Packages

PackageDescriptionUse Case
x402-stellarCore library with types, schemas, and facilitator clientBuilding custom integrations
x402-stellar-clientClient SDK for signing payments (Keypair + Freighter)Client applications
x402-stellar-fetchFetch wrapper that auto-pays 402 responsesSimple client integrations
x402-stellar-expressExpress middleware for protecting routesNode.js/Express servers
facilitatorStellar x402 facilitator serverPayment verification & settlement

Roadmap

See ROADMAP.md for our development plans.

Upcoming

  • Mainnet support
  • Additional client SDKs
  • More example integrations

Contributing & License

Contributions are welcome! This project is open source under the MIT License.

Built with ❤️ for the Stellar ecosystem.