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

# x402 Micropayments

> HTTP 402 payments wired through a Tachyon facilitator. Pay from any chain with any token; merchant address and amount stay confidential.

x402 is the HTTP-native payment standard for agents and APIs. Tachyon ships an x402 **facilitator** wired directly into the protocol, when a client agent pays a 402-protected endpoint, the payment is delivered as a confidential intent. The merchant's address and the amount stay private, and the payer can pay from **any chain with any supported token**.

<Note>
  Live on testnet. Mainnet coming soon.
</Note>

## Why this is different from a vanilla x402 facilitator

A standard x402 facilitator publishes the merchant's wallet address in the payment challenge, settles on a fixed chain, and exposes the amount on-chain. Repeated payments link agents to merchants and expose pricing.

The Tachyon facilitator handles the settlement leg as a **confidential intent**: the merchant's address rotates per payment (a fresh stealth address), the amount is not visible on-chain, and the payer can pay from a chain other than the merchant's settlement chain. Cross-chain hops are handled by the facilitator.

## Where it fits

* **AI agents** paying for compute, data, or model APIs
* **API providers** charging per call without exposing pricing or volume
* **Machine-to-machine commerce** where merchant identity must stay confidential

## How it works (integrator view)

The merchant runs an x402-enabled API. When a client calls without payment, the API responds with HTTP 402 and a payment challenge. The client's SDK or agent runtime hands the challenge to the Tachyon facilitator, which constructs a confidential intent on the client's behalf, settles, and returns proof of payment. The original API call is then retried with the proof attached.

```mermaid theme={null}
sequenceDiagram
    autonumber
    participant Agent as Client agent
    participant API as Merchant API
    participant Fac as Tachyon facilitator
    participant Chain as Destination chain

    Agent->>API: GET /resource
    API-->>Agent: 402 + payment challenge
    Agent->>Fac: pay(challenge, fundingChain, fundingToken)
    Fac->>Chain: confidential intent settles to merchant stealth addr
    Chain-->>Fac: settled
    Fac-->>Agent: proof of payment
    Agent->>API: GET /resource (X-Payment: proof)
    API-->>Agent: 200 + resource
```

## What's confidential

* **Merchant wallet address**, rotates per payment
* **Amount paid** for any individual call
* **Link** between agent and merchant across calls

What's necessarily public: the agent's funding action on its source chain (a public ERC-20 approval, for example). The 402 challenge itself does not reveal the merchant's settlement address.

## Pay from any chain, any supported token

Funding flexibility is core to the integration:

* The **merchant** picks the chain and asset they receive in (set when they configure their x402 server).
* The **client** picks the chain and asset they pay from. If the client's funding chain isn't a [Tachyon-supported source chain](/concepts/supported-chains), the facilitator hops via Near Intents or Relay before the confidential settlement leg.

## Integration shape, merchant

```ts theme={null}
import { tachyonX402 } from "@tachyon/x402";

app.use(
  tachyonX402({
    network: "testnet",
    receivingChain: "base",
    receivingToken: USDC_BASE,
    pricing: { "/resource": "0.01" }, // USD per call
  })
);

app.get("/resource", (req, res) => {
  res.json({ data: "..." });
});
```

## Integration shape, client agent

```ts theme={null}
import { TachyonAgent } from "@tachyon/agent";

const agent = new TachyonAgent({
  network: "testnet",
  funding: { chain: "arbitrum", token: USDC_ARB },
});

const response = await agent.fetch("https://api.example.com/resource");
```

The agent transparently handles the 402, pays via the facilitator, and retries.

<Note>
  The client/merchant TypeScript helpers shown above are WIP. Today, point your x402 facilitator URL at `https://facilitator.tachyon.pe` and use any standard x402 middleware, the Tachyon facilitator speaks the standard protocol.
</Note>

## Try it

<Card title="x402 facilitator" icon="globe" href="https://facilitator.tachyon.pe">
  Point any x402 client at this facilitator URL.
</Card>

<Card title="x402 integration guide" icon="play" href="/guides/x402-micropayments">
  Stand up a 402-protected API and pay it from a client agent on testnet.
</Card>
