# Agent to Agent payments (a402)

### What is a402?

**a402** is the open payment protocol behind **Beep Pay**. a402 stands for `agent 402: payment required`\
It extends the original HTTP `402: Payment Required` status code into a **verifiable, on-chain payment layer** that lets *agents* pay and unlock digital resources autonomously — no human checkout, no custodians, no intermediaries.

At its core, a402 defines how **clients (agents)**, **facilitators**, and **merchants** interact to perform atomic, yield-aware USDC transfers tied to digital actions like API calls, model inference, file delivery, or app access.

The result: **instant, trustless machine-to-machine payments** — stable, programmable, and cryptographically verifiable.

#### 💡 The Idea

HTTP 402 has existed for decades as a reserved response code for “Payment Required,” but until now it had no implementation.\
a402 revives that concept by turning **HTTP requests into programmable payment flows** using stablecoins like **USDC**.

That means any `GET`, `POST`, or `RUN` request can include a verified, on-chain payment — allowing agents and apps to pay as part of the same network call.

#### ⚙️ How It Works

1. **Client (Agent)** requests access to a protected resource (e.g., API, AI endpoint, dataset).
2. **Server (Merchant)** responds with:

   ```javascript
   HTTP 402 Payment Required
   Payment-Request: <encoded a402 payload>
   ```
3. **Client** executes the stablecoin transfer and sends back a **payment receipt**.
4. **Server or Facilitator** verifies the receipt on-chain.
5. Once verified, access is **granted instantly**.

Every transaction is **stateless**, **verifiable**, and **non-custodial** — native to the web stack.

#### 💸 Why It Matters

a402 makes payments a **first-class citizen of the web**.\
Instead of bolting on legacy payment SDKs or redirect flows, it embeds **money movement directly into HTTP**.

This enables:

* **Pay-per-call APIs** (monetize inference, data, compute)
* **Pay-per-second** streaming for media or model usage
* **Agent-to-agent commerce** for autonomous systems
* **Instant microtransactions** with no intermediaries or credit rails

In short, a402 bridges **the internet and the financial layer** — seamlessly, natively, and globally.

#### 🔐 Key Properties

* **Stablecoin-native:** built around on-chain USDC transfers
* **Instant settlement:** sub-second confirmation (Sui)
* **Verifiable receipts:** every payment has a cryptographic proof
* **Non-custodial:** sender and receiver control their own vaults
* **Composable:** works with existing web standards (HTTP headers, status codes)

#### How does a402 compare to x402 or L402?

* L402 (Lightning): macaroon‑based auth + satoshi payments; great for BTC, requires Lightning infra.
* x402 (Coinbase): strong push for EVM chains, lacks identity.
* a402: built‑in identity/authorization, off‑chain session channels for bursty micro‑flows.

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.justbeep.it/product-overview/agent-to-agent-payments-a402.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
