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

# x402 Payments

x402 is an open payment standard for AI-to-AI and agent-to-service transactions, built around the HTTP 402 Payment Required status code. ShadowPay supports it natively, so agent accounts can pay for API calls, compute, and services without credit cards, OAuth flows, or prepaid credit balances.

Solana carries roughly 65% of agentic on-chain payment volume today, and x402 is a major reason why: it gives services a standard way to say "this costs X" and gives agents a standard way to pay it, in-band, as part of the HTTP request itself.

***

## How it works

```
Agent requests a resource from an x402-enabled service
        ↓
Service responds: 402 Payment Required
  Headers specify: amount, asset, recipient address
        ↓
Agent's ShadowPay wallet evaluates the request against its spend policy
        ↓
Within policy: agent signs and submits a confidential USDC transfer
        ↓
Agent retries the original request with a payment proof header
        ↓
Service verifies payment on-chain and returns the resource
```

The entire loop happens without any human intervention, unless the payment exceeds the agent's human-in-the-loop threshold as defined in its [spend policy](/agents-and-automation/spend-policies.md).

***

## Supported flows

* **Pay-per-call:** the most common pattern. Each API request carries its own micropayment.
* **Metered usage:** a service can request incremental payments as usage accrues, rather than a single upfront charge.
* **Subscription-style billing:** a recurring x402 charge at a fixed interval, still evaluated against the agent's spend policy on every cycle.

***

## Why confidential transfers matter here

x402 payments happen at volume, often many small transactions per minute for an active agent. Without confidentiality, this would broadcast an agent's exact usage pattern and cost structure to anyone watching the chain, which can reveal sensitive information about a business's operations. ShadowPay's Confidential Balances integration means these payments settle with the same amount-hiding guarantees as any other transfer.

***

## Enabling x402 for your agent

x402 support is on by default for every Agent account. No separate configuration is required beyond setting a spend policy that allows the recipients you expect your agent to pay. See [Agents & Spend Policies](/api-reference/agents-and-spend-policies.md) for the API-level configuration.

***

## Next

* [Spend Policies](/agents-and-automation/spend-policies.md)
* [Webhooks & Events](/agents-and-automation/webhooks-and-events.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.useshadowpay.com/agents-and-automation/x402-payments.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.
