# Approval challenge

The approval challenge is the 401 response a store sends to ask a shopping agent's person to approve one exact order, with the header grammar, the approval_request body and a short parser.

The approval challenge (`WWW-Authenticate: ProvenanceIntent`) is a `401` response that a store sends to ask the person behind a shopping agent to approve one exact order. The agent's operator relays it, the person approves on their own device, and the agent retries with an intent token bound to that order.

## When to use it

- Your checkout would turn away an agent that brings no approval, and you'd rather let its person decide.
- An order needs more than your bot rules show, such as a biometric approval for a high-value cart.
- You run ACP: the same request rides in the session response (`acpApprovalRequired`).

## How it works

1. The store answers the checkout with `401`, a `WWW-Authenticate: ProvenanceIntent` header and an `approval_request` in an `application/problem+json` body (RFC 9457).
2. The agent authorizes the request's `binding` with `approval` on [`POST /v1/mandate/intents`](https://provenanceauth.com/docs/api/intent-tokens.md#post-v1-mandate-intents), taking the store origin from the URL it called. The answer is `approval_pending` until the person decides.
3. The agent retries the same request with `Provenance-Intent: <token>`. The store verifies it with `verifyAgentCheckout` against its own record of the order.

### The header

```http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: ProvenanceIntent realm="quillstack.example", action="checkout", binding="order"
Content-Type: application/problem+json
```

The auth-params name the store's host, the action (`checkout`) and what is bound (`order`).

`ProvenanceIntent` is an RFC 9110 authentication scheme, so other challenges may sit beside it in the same header. The retry credential goes in `Provenance-Intent`, never in `Authorization`, which your own API keeps for its auth.

### The body

```json
{
  "type": "https://provenanceauth.com/problems/approval-required",
  "title": "Approval required",
  "status": 401,
  "detail": "This store asks the shopper to approve this exact order.",
  "approval_request": {
    "object": "approval_request",
    "version": "2026-10-24",
    "action": "checkout",
    "binding": {
      "order_id": "ord_8812",
      "total": 3800,
      "currency": "usd",
      "merchant_id": "quillstack",
      "origin": "https://quillstack.example",
      "items": [{ "sku": "QS-LINEN-A5", "name": "Linen notebook, A5", "quantity": 2, "unit_amount": 1900 }]
    },
    "display": { "merchant_name": "Quillstack", "ships_to": { "city": "Portland", "region": "OR", "country": "US" } },
    "require": { "biometric": true },
    "expires_at": "2026-10-25T18:10:00Z",
    "retry": { "method": "POST", "url": "https://quillstack.example/checkout", "header": "Provenance-Intent" }
  }
}
```

| Field | What it holds |
| --- | --- |
| `binding` | The order exactly as `checkoutBinding(order)` returns it; the token's `payload_hash` is its canonical SHA-256 |
| `display` | What the order can't bind: the store's name, and a coarse ships-to (city, region, country) |
| `require` | `biometric: true` and an optional `min_tier` (`tee`, `strongbox` or `sep`) |
| `expires_at` | When the challenge lapses |
| `retry` | The request to repeat and the header that carries the token |

No field identifies the person: no name, email, address, account id, IP address, location or device fingerprint. The full shipping address is bound only as `fulfillment_digest`.

### Parse it yourself

The SDKs parse the challenge for you (`parseApprovalChallenge` in TypeScript, `parse_approval_challenge` in Python). In another client, this is the whole job:

```ts
async function parseChallenge(res: Response) {
  if (res.status !== 401) return null;
  const header = res.headers.get("www-authenticate") ?? "";
  if (!/(^|,)\s*ProvenanceIntent(\s|,|$)/i.test(header)) return null;
  const body = await res.clone().json().catch(() => null);
  const req = body?.approval_request;
  if (req?.object !== "approval_request" || req.action !== "checkout") return null;
  const calledOrigin = new URL(res.url).origin;
  if (req.binding?.origin !== calledOrigin) throw new Error("the challenge names another store");
  return {
    actionPayload: req.binding,
    approval: {
      merchant_origin: calledOrigin,
      display: req.display,
      expires_at: req.expires_at,
      require_biometric: req.require?.biometric === true,
    },
  };
}
```

Then send `actionPayload` and `approval` to [`POST /v1/mandate/intents`](https://provenanceauth.com/docs/api/intent-tokens.md#post-v1-mandate-intents), and repeat the call until its `status` is `approved` or a final reason.

### What the person sees

The approval screen, the approval embed and the approver portal render the stored request. The store origin comes first, its registrable part in bold, then "calls itself Quillstack", the items, the total, the ships-to line, the agent and a countdown.

One line says what approving signs: "Approving signs this exact order. Any change to the items, total or store needs a new approval." The person approves with face, fingerprint or passkey, declines, or declines and mutes the store.

### Limits

| Limit | Default |
| --- | --- |
| Pending step-ups per person per store | 1 |
| Per person per store per hour | 5 |
| Per person per store per day | 20 |
| Per operator account per hour | 30 |

Over a limit, authorize answers `429 rate_limit_exceeded` and nobody is notified.

## Related

- [Verify agent checkouts](https://provenanceauth.com/docs/authorize/guides/verify-agent-checkout.md#ask-the-shopper-to-approve)
- [Step-up approval](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md)
- [Framework integrations](https://provenanceauth.com/docs/mandate/guides/framework-integrations.md#5-answer-checkout-challenges)
- [Reason codes](https://provenanceauth.com/docs/platform/reason-codes.md)
