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

> ## Agent Instructions
> Anchor Browser is cloud browser infrastructure for AI agents and automation: browser sessions you control over CDP or REST, natural-language web tasks, versioned automation tasks, managed authentication into third-party web apps (identities with MFA), persistent volumes and profiles, recordings, live view, batch sessions, webhooks, and network options including residential proxies, extra stealth, and captcha solving for sites that block standard browsers. AI agents should start at https://docs.anchorbrowser.io/for-agents, then get an API key with Agent Access at https://docs.anchorbrowser.io/quickstart/agent-access — no dashboard account required. Read those two pages before authentication or API calls.

# Automatic x402 Payments

> Let browser sessions automatically access x402-protected websites with Amazon Bedrock AgentCore Payments

Anchor Browser can automatically pay websites and APIs that use the [x402 protocol](https://www.x402.org/). Payments are signed by Amazon Bedrock AgentCore Payments and retried inside the same browser session.

<Warning>
  This feature is in preview. Enabling it authorizes the browser to make real payments from the configured payment instrument.
</Warning>

## Enable automatic payments

Set `session.x402` to `true`. It defaults to `false`.

<CodeGroup>
  ```bash curl theme={null}
  curl --request POST \
    --url https://api.anchorbrowser.io/v1/sessions \
    --header "anchor-api-key: $ANCHOR_API_KEY" \
    --header "content-type: application/json" \
    --data '{"session":{"x402":true}}'
  ```

  ```javascript node.js theme={null}
  const response = await fetch('https://api.anchorbrowser.io/v1/sessions', {
    method: 'POST',
    headers: {
      'anchor-api-key': process.env.ANCHOR_API_KEY,
      'content-type': 'application/json',
    },
    body: JSON.stringify({ session: { x402: true } }),
  });

  const { data: session } = await response.json();
  console.log(session.cdp_url);
  ```
</CodeGroup>

Once connected through CDP, navigate normally. No wallet key or payment header is required in your automation code.

## Payment flow

1. Anchor creates a dedicated AgentCore PaymentSession for the browser session.
2. The browser receives an HTTP `402 Payment Required` response from an x402 resource.
3. It selects a payment method compatible with the configured instrument.
4. AgentCore verifies the session budget and generates the cryptographic payment proof.
5. The browser retries the original request once with `PAYMENT-SIGNATURE` for x402 v2 or `X-PAYMENT` for x402 v1.
6. The merchant verifies and settles the payment, then returns the protected resource.

## Limits and failure behavior

* Each browser session has a maximum x402 spend of **\$0.01 USD**.
* The payment authorization expires after **480 minutes**, even if the browser remains open longer.
* Only document navigation, `fetch`, and XHR requests are handled automatically.
* If the merchant response is malformed, no compatible network is offered, the budget is exhausted, or AgentCore rejects the payment, the original `402` response is returned to the page.
* `x402` controls payments to third-party resources. It does not replace Anchor credits or pay for the browser session itself.

## Security

Your automation code never receives wallet credentials. Automatic payments are available only when `session.x402` is explicitly enabled and remain subject to the spending and expiration limits described above.

Learn more in the [AgentCore Payments overview](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/payments.html) and [browser integration guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/payments-browser.html).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.