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

# AnySpend x402 overview

> Pay for paywalled APIs and services with any token using the x402 open payment protocol

<CardGroup cols={2}>
  <Card title="GitHub Repository" icon="github" href="https://github.com/b3-fun/anyspend-x402">
    View source code, examples, and contribute
  </Card>

  <Card title="npm Package" icon="npm" href="https://www.npmjs.com/package/@b3dotfun/anyspend-x402">
    Install @b3dotfun/anyspend-x402 package
  </Card>
</CardGroup>

## What is AnySpend x402

AnySpend x402 is B3's implementation of the **x402 payment protocol** that enables instant, automatic cryptocurrency payments directly over HTTP. Unlike traditional x402 facilitators that only support USDC, **AnySpend allows you to pay with any compatible token** (EIP-2612 or EIP-3009) while resource servers receive any token they prefer.

The x402 protocol modernizes the HTTP `402 Payment Required` status code, turning it into a practical solution for machine-to-machine micropayments, paywalled APIs, and autonomous agent interactions.

## For buyers (payers)

Pay for paywalled resources using any compatible token you hold:

* **Pay with compatible tokens**: Use any token with EIP-2612 or EIP-3009 support for gasless payments
* **Standard protocol**: Works with any x402-enabled service using standard HTTP
* **No manual swaps**: AnySpend automatically converts your token to what the seller needs
* **Simple integration**: One SDK works across all x402 services

<Card title="Token Compatibility Checker" icon="check-circle" href="https://anyspend.com/x402-tokens">
  Browse compatible tokens with EIP-2612 or EIP-3009 support across 19+ networks
</Card>

**Use Cases:**

* Access premium APIs and AI agent services
* Pay for computational resources and data feeds
* Enable autonomous agent-to-agent payments
* Consume paywalled content programmatically

## For sellers (resource servers)

Accept payments in USDC while your customers pay with their preferred token:

* **Receive USDC**: Get paid in USDC regardless of what token the customer uses
* **Express middleware**: Add payments to your API with just a few lines of code
* **No blockchain infrastructure**: AnySpend handles all on-chain complexity
* **Instant settlement**: Payments are verified and settled automatically

**Use Cases:**

* Monetize premium APIs and data services
* Build paid AI agent workflows
* Create paywalled content and tools
* Accept crypto payments without crypto expertise

## Quick start

Choose your path:

<CardGroup cols={2}>
  <Card title="I want to pay for services" icon="wallet" href="/anyspend/x402-quickstart-buyers">
    **For Buyers**: Learn how to use the x402 client SDK to pay for paywalled resources with any token
  </Card>

  <Card title="I want to accept payments" icon="cash-register" href="/anyspend/x402-quickstart-sellers">
    **For Sellers**: Add the Express middleware to your API and start accepting multi-token payments
  </Card>
</CardGroup>

## How it works

<Steps>
  <Step title="Client Requests Resource">
    User's application makes a standard HTTP request to your API
  </Step>

  <Step title="Payment Required">
    Your API returns `402 Payment Required` with payment details
  </Step>

  <Step title="Token Preference">
    Client specifies their preferred payment token (USDC, USDT, etc.)
  </Step>

  <Step title="AnySpend Quotes">
    AnySpend calculates the equivalent amount in the client's chosen token
  </Step>

  <Step title="Client Signs Payment">
    User signs a cryptographic authorization for their token
  </Step>

  <Step title="Automatic Settlement">
    AnySpend swaps the token to USDC and settles to your wallet
  </Step>

  <Step title="Resource Delivered">
    Your API receives payment confirmation and returns the requested resource
  </Step>
</Steps>

## Key differentiators

### Multi-token support

**Standard x402**: Resource servers and clients must both use USDC

**AnySpend x402**: Clients pay with **any compatible token** (EIP-2612 or EIP-3009 support required) they hold. AnySpend handles the conversion.

```
Client pays with DAI (EIP-2612) → AnySpend swaps to 1 USDC → Seller receives 1 USDC
```

### No infrastructure required

Resource servers don't need to:

* Run blockchain nodes
* Manage wallets or private keys
* Handle token swaps or bridging
* Monitor transaction status

AnySpend's facilitator handles all blockchain operations and provides simple HTTP endpoints for verification and settlement.

### Standard protocol compliance

Clients using AnySpend don't need to know they're using a special facilitator. The flow uses standard x402 protocol messages, and the multi-token conversion happens on the resource server side through middleware.

## Package delivery

AnySpend x402 consists of two packages:

<CardGroup cols={2}>
  <Card title="Server SDK" icon="server">
    **@b3dotfun/anyspend-x402**

    Universal server middleware supporting Express, Next.js, and Hono for resource servers to easily accept multi-token payments
  </Card>

  <Card title="Client SDK" icon="code">
    **anyspend-x402-client**

    Platform-agnostic TypeScript SDK for clients to make payments with signature helpers
  </Card>
</CardGroup>

## Powered by AnySpend facilitator

All x402 payments are processed through the AnySpend Facilitator, which handles:

* Multi-token support across 19+ blockchain networks
* Automatic token swaps and cross-chain routing
* Gasless payments for users
* Standards-compliant x402 implementation
* Drop-in replacement for any x402 facilitator

**Production Endpoint:** `https://mainnet.anyspend.com/x402`

<Card title="AnySpend facilitator" icon="server" href="/anyspend/x402-facilitator">
  API endpoints, architecture, and configuration
</Card>
