Documentation
Integrate x402-stacks into your project in minutes.
Quick Start
The x402-stacks package provides everything you need to accept and make payments using the x402 protocol on Stacks. It supports settlement in STX, sBTC, and USDCx tokens. Each endpoint gets its own payment gate with independent pricing and token selection.
Monetize Your API
Add the x402-stacks paymentMiddleware to your Express.js server. Each endpoint gets its own payment gate with a config object specifying the pay-to address, amount in micro-units, token type, and network in CAIP-2 format. The middleware returns HTTP 402 with payment details when no payment header is present, and verifies payments via the facilitator when a payment-signature header is included.
Register Your Service
List your API on the marketplace registry so buyers and agents can discover it. Use the REST API to register programmatically.