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

# How Facilitator Service works

> How Facilitator Service settles USDC through EIP-3009 as the facilitator between buyer and seller

Facilitator Service settles [x402](/gateway/nanopayments/concepts/x402) payments
in USDC after the buyer signs the authorization. It validates each signature,
screens both parties, and submits the transfer through a Circle relayer.

## Authentication

Facilitator Service requires a Circle [API key](/api-reference/keys#api-keys) to
settle payments in production.

You can trial Facilitator Service without a Circle account through the
[keyless trial](/facilitator-service/keyless-trial). A trial allowance applies
until you claim your seller account.

## Roles

Every Facilitator Service payment involves three actors:

* **Buyer**: an HTTP client, typically an AI agent, that signs an
  [EIP-3009](https://eips.ethereum.org/EIPS/eip-3009) authorization to pay for a
  resource.
* **Seller**: an HTTP resource server that asks for payment before returning a
  result, then calls Facilitator Service to settle the buyer's authorization.
* **Facilitator**: screens both parties, submits the USDC transfer through a
  Circle relayer, and pays settlement gas.

## The payment flow

```mermaid theme={null}
sequenceDiagram
    participant Buyer as Buyer (agent)
    participant Seller as Seller (HTTP API)
    participant Facilitator Service as Facilitator Service (facilitator)
    participant Chain as USDC contract

    Buyer->>Seller: GET /resource
    Seller-->>Buyer: 402 Payment Required + payment requirements

    Note over Buyer: Signs EIP-3009 authorization

    Buyer->>Seller: GET /resource + signed authorization
    Seller->>Facilitator Service: POST /v1/facilitator/x402/settle
    Note over Facilitator Service: Screens buyer and seller
    Facilitator Service->>Chain: transferWithAuthorization
    Chain-->>Facilitator Service: Transfer confirmed
    Facilitator Service-->>Seller: success + transaction hash
    Seller-->>Buyer: 200 OK + resource
```

1. A buyer requests a paid resource from the seller's API.
2. The seller returns `402 Payment Required` with the payment requirements.
3. The buyer signs an EIP-3009 authorization offchain and retries the request.
4. The seller sends the signed authorization to Facilitator Service using
   [`/settle`](/api-reference/agent-stack/facilitator-service/settle-payment).
5. Facilitator Service screens both parties. If either fails, it refuses to
   settle. Otherwise, it submits the USDC transfer through a Circle relayer.
6. Once confirmed, Facilitator Service returns the transaction hash to the
   seller, who fulfills the request.

Facilitator Service saves the payment record before broadcasting the
transaction, so a retry with the same identifier always resolves to the same
payment. This prevents double charges.

## EIP-3009 authorizations

Facilitator Service uses [EIP-3009](https://eips.ethereum.org/EIPS/eip-3009) as
the payment primitive. The buyer signs a `TransferWithAuthorization` message
offchain, and Facilitator Service submits it to the USDC contract on the
payment's blockchain to move USDC from buyer to seller.

Facilitator Service accepts signatures from externally owned accounts (EOAs) and
from deployed smart contract accounts through
[ERC-1271](/gateway/references/erc-1271). Smart contract accounts that aren't
deployed yet (ERC-6492) are not supported.

Before Facilitator Service submits the transaction, it validates the following:

* That the buyer's signature is valid
* That the buyer has sufficient USDC balance
* That the `to` address in the authorization matches the seller's `payTo`

Then Facilitator Service calls `transferWithAuthorization` on the USDC contract.
