> For the complete documentation index, see [llms.txt](https://docs.sectoral.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sectoral.xyz/ai-agents/x402.md).

# Paying with x402

x402 is an open protocol that lets machines pay machines, built around the HTTP 402 Payment Required status code that went largely unused for years. Sectoral supports it natively. An agent account can therefore pay for API calls, compute and services without a card, without an OAuth flow, and without a prepaid balance that needs refilling. Payments happen as fast as an HTTP request and response.

Robinhood Chain was built with this audience in mind: its stated purpose is to let agents trade, swap and pay. x402 is the natural way to express payments there. Services get a standard format for quoting a price, and agents get a standard format for paying it, inline, within the request they were already sending.

***

## How a payment flows

```
Agent asks an x402-enabled service for a resource
        ↓
Service replies: 402 Payment Required
  Headers specify amount, asset, recipient
        ↓
Agent's Sectoral wallet checks the request against its spend policy
        ↓
Within policy: agent signs and sends a confidential USDG transfer
        ↓
Agent sends the request again, this time with proof of payment
        ↓
Service verifies on-chain and returns the resource
```

No human is involved at any point, unless the amount exceeds the approval threshold set in the agent's [spend policy](/ai-agents/policy-engine.md). Transactions run at machine speed while your safeguards stay in place.

***

## Payment patterns

* **Pay-per-call:** the most common pattern, where each request includes its own micropayment.
* **Metered:** the service charges in increments as usage builds up, rather than collecting in advance.
* **Recurring:** an x402 charge on a regular schedule, checked against the spend policy each time it comes due.

***

## Why these payments are encrypted

x402 is inherently high volume, and an active agent can settle a large number of small payments every minute. If that stream were public, anyone interested could read your usage pattern and cost structure from it, which amounts to giving competitors free intelligence. Sectoral's confidential token contracts apply the same amount hiding to these payments (whether USDG, bridged USDC or ETH) as to every other transfer. Agents can transact without leaking telemetry.

***

## Enabling x402

There is no switch to flip. Every Agent account has x402 active out of the box. All you need is a spend policy that allows the recipients you expect to pay. To set that up from code, see [Agent and Policy Endpoints](/developer-api/agents.md).

***

## Read next

* [Spend Policy Engine](/ai-agents/policy-engine.md)
* [Real-Time Event Stream](/ai-agents/event-stream.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sectoral.xyz/ai-agents/x402.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
