# Agentic shopping and agentic checkout

An agent that browses is not thereby checking out. SACP separates agentic shopping from agentic checkout. Every request in the declared, machine-readable agent lane carries a phase, so a shop and its fraud team can label and score the two activities separately.

## The two phases

**Agentic shopping** is discovery, browsing, comparison, building a cart and recommendation. It creates no financial obligation. In this draft it covers `GET /.well-known/sacp`, `POST /catalog/search`, `GET /catalog/product/{id}`, `POST /shipping/quote`, `POST /negotiation/offer` and `POST /collection/items`. A shipping quote and an item collection are still shopping: they prepare a proposal, they do not commit the buyer.

**Agentic checkout** is the agent executing or initiating a payment or an order commitment. In SACP it begins at `POST /checkout/prepare`. It also covers any later commit point, when an order is created or a payment is authorized. A shopping call must never create an order or charge a card.

Added in `1.2.0-draft`. The fields are optional. A shop that does not advertise `agent.lane` in its discovery document behaves as in 1.1.0, and an agent must not assume a declared lane there.

## The declared agent lane

The agent lane is the shop API itself, used by an agent that identifies as an agent. The agent does not pretend to be a person browsing the HTML store. Every request in that lane declares who the agent is and which phase it is in. Schema: [`/schemas/agent-lane.schema.json`](https://agenthandelstandard.se/schemas/agent-lane.schema.json).

On `POST` the declaration is the object `agent` in the JSON body, the headers, or both. On `GET` it is the headers. If a body and a header are both present, they must match or the shop answers 400 `phase_conflict`.

| Field or header | Meaning |
|---|---|
| `agent.id` / `SACP-Agent-Id` | A stable identifier for this agent. Required when the shop advertises `agent.lane`. |
| `agent.agent_phase` / `SACP-Agent-Phase` | `shopping` or `checkout`. Required on every lane request. |
| `agent.checkout_mode` / `SACP-Checkout-Mode` | Required when the phase is `checkout`. `human_handoff` or `autonomous`. |
| `agent.name` | Optional display name. |

Example headers on a catalog search:

```json
{
  "SACP-Agent-Id": "agent:buyer-agent-7",
  "SACP-Agent-Phase": "shopping"
}
```

The same declaration in a `POST` body:

```json
{
  "agent": {
    "id": "agent:buyer-agent-7",
    "name": "Example Buyer Agent",
    "agent_phase": "shopping",
    "checkout_mode": "human_handoff"
  },
  "query": "trail running shoes",
  "max_price": 1500
}
```

## Human handoff and autonomous checkout

A checkout request must declare `checkout_mode`.

| Mode | What happens |
|---|---|
| `human_handoff` | The shop issues a handoff URL for Swish, IBAN, card, crypto, or another name it declares. A person confirms the payment. This is the default, and the only mode in 1.0.0 and 1.1.0. The API does not carry a card number or a private key. |
| `autonomous` | The agent asks the shop to commit without a further human payment confirmation. A shop may offer this only when it advertises the capability `checkout.autonomous`, the request carries approved terms, and a mandate covers those exact terms. See [approved terms](https://agenthandelstandard.se/intent-binding/) and [authority](https://agenthandelstandard.se/authority/). A shop that does not advertise the capability answers 403 `autonomous_not_offered`. |

Autonomous checkout does not change who is merchant of record, and it does not let the API carry a card number or a private key. The payment credential stays with the shop or the payment service the mandate names.

## What shopping requires

- The agent must identify itself. Anonymous scraping of the HTML store is outside the lane.
- The shop publishes a shopping rate limit in discovery, as requests per minute per agent and a burst. Exceeding it returns 429 `rate_limited` with `retry_after_seconds`. A shop may set a stricter limit than it does for a person.
- A shopping call must not create an order, must not charge a card, and must not be labelled `checkout`.
- Intent binding and the authority check are not required in this phase. A shop may still accept a mandate on a shopping call so the catalog is limited to in-scope items, but that presentation is not a commit.
- A shop may collect fraud or risk signals during shopping. It must label them `shopping`, and must not feed them into a checkout score as if they were a payment attempt.

## What checkout requires

- The agent must identify itself, and `agent_phase` must be `checkout`. A call to `/checkout/prepare` labelled `shopping` is refused with 400 `phase_mismatch`. A shopping path that would commit is refused the same way.
- Intent binding applies. The request carries `approved_terms`, the shop re-quotes, and a material change voids the approval and issues no handoff. See [approved terms](https://agenthandelstandard.se/intent-binding/).
- Authority applies where the shop advertises it. The mandate must cover the exact bound terms before the handoff is issued and again at the commit point. See [authority](https://agenthandelstandard.se/authority/).
- `checkout_mode` must be declared. `autonomous` additionally requires the capability `checkout.autonomous` and a covering mandate.
- Fraud and risk signals are required at checkout. The shop, or the fraud process it uses, records at least the agent id, the phase, the checkout mode, the terms hash, the mandate id when one is present, the request origin and timing, and any risk score the shop already uses for a person. These records are labelled `checkout`.

A shop that advertises neither `terms.binding` nor `authority.mandate` still requires the phase declaration if it advertises `agent.lane`, and still issues a human handoff as in 1.0.0.

## How fraud teams label and score the phases

A request in the shopping phase is not a payment attempt. A request in the checkout phase is. Merchants' fraud teams should treat them as two different events.

- Label every event with `agent_phase` and, at checkout, `checkout_mode`.
- Keep separate risk scores, thresholds and playbooks for shopping and for checkout. A high shopping volume is not by itself a checkout risk. A checkout with no preceding shopping trail may itself be a signal.
- Treat a missing, false or mismatched phase as a risk signal: `phase_undeclared`, `phase_mismatch` or `phase_conflict`. Labelling a checkout as shopping is always a mismatch, not a normal step.
- A shopping session may later open a checkout request. That sequence is expected. It is not a flip.
- At checkout, also score the terms hash, the mandate, the approval evidence and the mode. Autonomous checkout is a higher-assurance event and should use a stricter playbook than a human handoff.

SACP does not define a risk-score formula and does not name a fraud vendor. It defines the phase labels and the signals a shop should pass to its own fraud process, or to any provider it already uses.

## How this ties to approved terms and authority

A terms snapshot may be built during shopping. A customer, or an approver, may approve it then. That approval stays bound to the `terms_hash`. It becomes a commit only at checkout, when the shop re-quotes and compares the live terms with the snapshot. See [re-quote at checkout](https://agenthandelstandard.se/intent-binding/#requote).

A mandate may already be presented during shopping, so the agent only sees items inside its scope. The shop must not treat that presentation as authority to commit. The mandate is checked against the exact bound terms at `/checkout/prepare` and again at the commit point. See [policy-bound execution](https://agenthandelstandard.se/authority/#execution).

## Discovery

A shop advertises the lane as the capability `agent.lane`. Autonomous checkout is a separate capability, `checkout.autonomous`. A shop that omits it offers only `human_handoff`.

```json
{
  "capabilities": [
    "catalog.search",
    "catalog.product",
    "shipping.quote",
    "negotiation.offer",
    "collection.items",
    "checkout.handoff",
    "terms.binding",
    "authority.mandate",
    "agent.lane"
  ],
  "extensions": {
    "agent_lane": {
      "phases": [
        "shopping",
        "checkout"
      ],
      "checkout_modes": [
        "human_handoff"
      ],
      "identification": [
        "body.agent",
        "SACP-Agent-Id"
      ],
      "shopping_rate_limit": {
        "requests_per_minute": 60,
        "burst": 20
      },
      "checkout_rate_limit": {
        "requests_per_minute": 10,
        "burst": 3
      }
    }
  }
}
```

## Error bodies

Schema: [`/schemas/agent-lane-outcomes.schema.json`](https://agenthandelstandard.se/schemas/agent-lane-outcomes.schema.json).

| Result | HTTP | Body |
|---|---|---|
| Path and phase do not match | 400 | `phase_mismatch` |
| Shop advertises the lane, no phase sent | 400 | `phase_undeclared` |
| Header and body disagree | 400 | `phase_conflict` |
| Rate limit exceeded | 429 | `rate_limited` |
| Autonomous checkout not offered | 403 | `autonomous_not_offered` |

Example of a 400 when `/checkout/prepare` is labelled shopping:

```json
{
  "code": "phase_mismatch",
  "declared": "shopping",
  "required": "checkout",
  "path": "/checkout/prepare"
}
```

## Example checkout declaration

Headers:

```json
{
  "SACP-Agent-Id": "agent:buyer-agent-7",
  "SACP-Agent-Phase": "checkout",
  "SACP-Checkout-Mode": "human_handoff"
}
```

Body, beside `approved_terms` and `authority`:

```json
{
  "agent": {
    "id": "agent:buyer-agent-7",
    "name": "Example Buyer Agent",
    "agent_phase": "checkout",
    "checkout_mode": "human_handoff"
  },
  "payment_handoff": "swish",
  "approved_terms": {
    "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb"
  },
  "authority": {
    "mandate": "<compact JWS of the mandate>"
  }
}
```

## Conformance

- A shop that advertises `agent.lane` must read the phase on every lane request, refuse a mismatch or a missing declaration, apply the published rate limits, and pass the phase label to its fraud process.
- It must never treat a shopping call as a payment attempt, and must never issue a handoff or create an order on a request labelled `shopping`.
- If it advertises `checkout.autonomous`, it must still require approved terms and a covering mandate, and it must not carry a card number or a private key on the API.
- An agent in the lane must declare the phase on every request, must not label a checkout as shopping, and must set `checkout_mode` on every checkout call.
- A shop that does not advertise `agent.lane` behaves as in 1.1.0.

## Questions

### What is the difference between agentic shopping and agentic checkout?

Agentic shopping is discovery, browsing, comparison, cart building and recommendation. It creates no financial obligation. Agentic checkout is the agent executing or initiating a payment or an order commitment. In SACP that begins at POST /checkout/prepare. The two phases are labelled separately in the declared agent lane.

### How does an agent declare which phase it is in?

Every request in the lane carries agent_phase, set to shopping or checkout, as the JSON field agent.agent_phase or the header SACP-Agent-Phase. A checkout request also declares checkout_mode: human_handoff, which issues a URL for a person to confirm, or autonomous, which is allowed only when the shop offers it and a mandate covers the exact terms.

### Why should fraud teams score shopping and checkout separately?

A shopping request is not a payment attempt. A checkout request is. Fraud teams should label every event with the phase and keep separate scores, thresholds and playbooks. A high shopping volume is not by itself a checkout risk. A missing, false or mismatched phase is itself a risk signal.
