> ## Documentation Index
> Fetch the complete documentation index at: https://docs.madra.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# introduction

> StellarX402 enables per-request HTTP payments on Stellar using the x402 protocol. Monetize any API endpoint without accounts, billing systems, or API keys.

StellarX402 lets you monetize any HTTP API endpoint by requiring a real crypto payment with every request — no accounts, no billing dashboards, no API keys. Built on the open x402 protocol and the Stellar blockchain, it turns payment into a single HTTP header that any client — browser, mobile app, or AI agent — can attach automatically.

## What Is x402?

The [HTTP 402 "Payment Required"](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402) status code has been reserved since 1991, but never formally standardized — until now. The x402 protocol, governed by the [x402 Foundation](https://x402.org) (a Linux Foundation project), gives 402 a concrete meaning: when a client requests a protected resource without payment, the server responds with `402 Payment Required` and a `PaymentRequired` header that describes exactly what is owed, in what token, on which network.

The client reads that header, builds and signs a payment transaction, and re-sends the original request with an `X-Payment` header attached. A **facilitator** service verifies and settles the payment on-chain. From the end user's perspective the entire exchange collapses into a single HTTP round-trip.

StellarX402 implements x402 v2 on the **Stellar blockchain**, using **USDC** (SEP-41 compliant) as the default payment token, with \~5-second settlement finality and zero network fees for end users (facilitators sponsor fees on your behalf).

## Key Use Cases

**API monetization** — Charge per call for any REST or GraphQL endpoint. Set prices in USDC down to the fraction of a cent, and collect revenue the instant each request is served.

**AI agent payments** — Autonomous agents can discover, negotiate, and pay for resources programmatically without human intervention or pre-loaded API keys. x402's machine-readable payment headers are a natural fit for agentic workflows.

**Micropayments** — Traditional payment rails make sub-dollar transactions uneconomical. Stellar's low-cost infrastructure makes per-request charges as small as fractions of a cent viable for the first time.

**Machine-to-machine (M2M) payments** — IoT devices, data pipelines, and microservices can pay each other for resources on demand, turning internal cost centers into auditable, metered transactions.

## Who Is StellarX402 For?

| Audience                | What you build                                                                        |
| ----------------------- | ------------------------------------------------------------------------------------- |
| **API developers**      | Metered endpoints that earn revenue with every call — no billing integration required |
| **SaaS builders**       | Usage-based pricing without subscription infrastructure or payment processor accounts |
| **AI agent developers** | Agents that autonomously discover and pay for third-party APIs in a single round-trip |

## Get Started

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Protect your first endpoint and make a paid request in under five minutes.
  </Card>

  <Card title="How It Works" icon="circle-info" href="/how-it-works">
    Walk through the full x402 payment flow from HTTP request to blockchain settlement.
  </Card>

  <Card title="Protect an Endpoint" icon="lock" href="/guides/protect-an-endpoint">
    Add x402 middleware to your Express, FastAPI, or Next.js server.
  </Card>

  <Card title="API Reference" icon="code" href="/api/overview">
    Full reference for the StellarX402 middleware, client SDK, and facilitator API.
  </Card>
</CardGroup>

## Key Benefits

<CardGroup cols={3}>
  <Card title="No Accounts or Keys" icon="key">
    Clients pay with their Stellar wallet. You never issue API keys or manage subscriber records.
  </Card>

  <Card title="Instant Settlement" icon="bolt">
    Payments settle on Stellar in \~5 seconds. Revenue arrives in your wallet before the response is fully transmitted.
  </Card>

  <Card title="Zero Fee Burden" icon="circle-dollar-to-slot">
    Facilitators sponsor Stellar network fees, so neither you nor your users pay gas costs on top of the resource price.
  </Card>

  <Card title="Any Client, Any Platform" icon="laptop-mobile">
    Works in browsers, mobile apps, and headless agents. Compatible wallets include Freighter, Albedo, Hana, HOT, Klever, and OneKey.
  </Card>

  <Card title="Open Protocol" icon="globe">
    x402 is governed by the x402 Foundation under the Linux Foundation — no vendor lock-in, no proprietary wire format.
  </Card>

  <Card title="Testnet & Mainnet" icon="flask">
    Switch between Stellar Testnet and Mainnet with a single config flag. Build and test without spending real USDC.
  </Card>
</CardGroup>
