Full A-Comm Evidence Protocol Specification
The full specification is available to implementers and partners under access review during provisional patent filing. For the public summary, see the public A-Comm Evidence Protocol overview.
Requests are reviewed within 1 business day. Approved implementers receive a one-click access link at the email they provided. Link is valid for 7 days.
Open Protocol Specification

A-Comm Evidence Protocol (AEP) v1.0.1

A cryptographically verifiable evidence standard for agentic commerce transactions — from AI-driven discovery through payment authorization and fulfillment.

v1.0.1 Apache License 2.0 Published by A-Comm Inc. 2026

Abstract

The A-Comm Evidence Protocol (AEP) defines a standard for generating, storing, and verifying cryptographic evidence of agentic commerce transactions. As AI agents increasingly drive product discovery and purchase decisions, merchants and payment processors require a dispute-grade audit trail that can demonstrate the provenance of any transaction — from the AI platform that surfaced the product through to payment authorization and fulfillment.

AEP specifies a sequential hash chain of typed artifacts, each immutably linked to its predecessor via SHA-256. The chain spans seven defined layers: discovery, referral, intent, policy, cart, authorization, and fulfillment. Any insertion, deletion, or modification of an artifact is cryptographically detectable at every subsequent node in the chain. The protocol is designed to be implementable by any PSP, commerce platform, or merchant independently of A-Comm Inc.'s infrastructure.

Status of This Document

Draft Specification This is AEP v1.0.1, a reference-implementation alignment update to the v1.0 stable specification. Payload schemas are now normatively defined per artifact type. Changelog entries document all field-level changes from v1.0. Feedback and interoperability reports are welcome via the public repository. This specification is published under Apache License 2.0.

A-Comm Inc. maintains the reference implementation. The protocol itself is open and implementable by any party without restriction, royalty, or permission from A-Comm Inc.

License

Copyright 2025 A-Comm Inc. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this specification except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, materials distributed under the License are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.


1. Introduction

1.1 Problem Statement

AI-mediated commerce is growing rapidly. Consumers increasingly discover and purchase products through AI chat interfaces — ChatGPT, Google Gemini, Perplexity, Microsoft Copilot — where product recommendations drive real transactions. This creates a new class of dispute risk:

  • The consumer interacted with an AI agent, not a human or traditional web UI
  • No browser-native referrer chain is reliable across AI platforms
  • The authorization trail exists, but the intent trail — what was asked, what was recommended, what was confirmed — is typically absent from PSP evidence
  • Merchants cannot prove to card networks that a consumer explicitly authorized an agentic transaction

AEP solves this by defining a tamper-evident evidence chain that captures every step from AI-driven discovery through order fulfillment, producing a dispute-grade artifact bundle that merchants can submit to PSPs and card network reviewers.

1.2 Design Goals

  • Tamper-evident: Any modification to any artifact in the chain is detectable at all subsequent nodes without requiring a trusted third party.
  • Dispute-grade: The evidence bundle maps directly to Stripe, Adyen, and card network representment evidence fields.
  • PII-minimal: Consumer identifiers are pseudonymized. No raw card data, no PAN, no personal identifiers in any artifact payload.
  • Platform-agnostic: Works across Shopify, WooCommerce, BigCommerce, Magento, and any PSP.
  • Open: Apache 2.0. Any implementation can generate and verify AEP chains without dependency on A-Comm Inc.
  • Attribution-aware: Bridges AI platform citation events (ChatGPT, Gemini, Perplexity, Copilot) into the cryptographic chain as a first-class artifact type.

2. Data Model

An AEP commerce journey is modeled as a single transaction chain — an ordered sequence of immutable artifacts. Each artifact records one event in the consumer's journey and is cryptographically linked to its predecessor.

2.1 Commerce Journey Layers

A complete agentic commerce transaction spans up to seven artifact layers. The first two (discovery and referral) are present only when the consumer arrived via an external AI platform:

1
Discovery ai_referral types only

Captures the AI platform citation event — the moment a product was surfaced in a ChatGPT, Gemini, Perplexity, or Copilot response. Records the platform, the consumer's query, the product URL cited, and the attribution method used to link the AI citation to the inbound session.

  • Actor type: agent (AI platform) or merchant (tracked link)
  • Key payload fields: platform, query, referral_url, citation_position, attribution_method
2
Referral ai_referral types only

Records the inbound session that originated from the AI citation — the click from the AI platform to the merchant's site, including session token, referral event ID, and the product that was cited.

3
Intent

Records the consumer's (or their agent's) explicit purchase intent: the product selected, quantity, variant, and the actor responsible. This is the earliest layer present for all transaction types.

  • Key payload fields: product_id, product_name, quantity, variant, query
4
Policy

Records the outcome of the merchant's policy engine evaluation — whether the transaction was permitted or blocked, which rules were evaluated, and the evaluation result. Required on all transaction types. The policy check must occur before authorization.

5
Cart

Records the consumer's explicit cart confirmation before checkout — the items in the cart, total amount, currency, and the confirmation signal. Provides the "authorization trail" for the agentic transaction.

  • Key payload fields: confirmed (boolean), items (array), total_amount, currency
6
Authorization Seal Point

Records the PSP payment authorization result. The current_hash of this artifact becomes the sealed_bundle_hash — the immutable seal of the transaction. Post-seal, only fulfillment artifacts may be appended.

  • Actor type: psp
  • Key payload fields: payment_token_reference (never raw card data), psp, authorization_code, amount_authorized, currency
7
Fulfillment

Records the fulfillment provider's response: carrier, tracking number, shipping status, and delivery confirmation. May arrive asynchronously after the chain is sealed. Implementors must support a late-arrival append path that does not require breaking the seal.

  • Actor type: fulfillment_provider
  • Key payload fields: carrier, tracking_number, status, shipped_at, delivered_at

2.2 Transaction Type Matrix

Transactions are classified on two orthogonal axes: how the consumer arrived (AI referral vs. direct) and how they purchased (via merchant agent vs. standard storefront checkout). This produces a 2×2 matrix:

Type Arrival Purchase Path Expected Artifacts Notes
ai_referral_agent_session External AI (ChatGPT, Gemini, etc.) Merchant voice/chat agent 7 All layers present. Full discovery + referral + agent interaction trail.
ai_referral_standard_checkout External AI referral Standard storefront checkout (Shopify, WooCommerce, etc.) 7 Discovery + referral present; cart and auth sourced from platform webhook.
agent_session_only Direct (no AI referral) Merchant voice/chat agent 5 No discovery or referral artifacts. Starts at intent.
direct_web Direct Standard storefront checkout 5 No discovery or referral artifacts. Starts at intent.
Chain completeness check Verification implementations must check total_artifacts == 7 for ai_referral_* types and total_artifacts == 5 for agent_session_only and direct_web types. A chain with fewer artifacts than expected is marked chain_complete: false but remains valid if all present artifacts verify correctly.

2.3 Sequential Hash Chain Model

AEP uses a sequential previous-hash model where previous_hash is included inside the hash input of every artifact. This is distinct from reference-pointer hash chain models:

Model Formula Chain break detection
AEP (sequential) current_hash = SHA256(canonical({...all_fields, previous_hash})) Any insertion, deletion, or mutation is detectable at every subsequent artifact
Reference-pointer model current_hash = SHA256(payload) + separate chained_from pointer Only detects breaks if the pointer is verified separately — pointer can be silently remapped

Because previous_hash is inside the hash input, any reordering or insertion in the sequence invalidates the hash of every subsequent artifact. Verification does not require a trusted third party — anyone with the artifact sequence can independently verify integrity.

Genesis
prev_hash: null
sequence_number = 1
Artifact 2
prev = hash(artifact_1)
prev_hash IN input
Artifact N
prev = hash(artifact_N-1)
...
Auth (Seal)
sealed_bundle_hash = this hash
Immutable seal point
Fulfillment
Post-seal append
Async late-arrival

2.4 Actors

Every artifact is attributed to a specific actor — the entity responsible for that event in the commerce journey:

Actor Type Description Typical Artifact Layers ID Format
user Human consumer intent, cart HMAC-SHA256 pseudonym (see §8.2)
agent AI agent (merchant chat/voice agent, or external AI platform) discovery, intent, cart agent_name[:version] or platform slug
merchant Merchant system (referral tracking, policy engine) referral, policy Merchant account ID
psp Payment service provider authorization PSP name + transaction ID (tokenized)
fulfillment_provider Shipping/logistics provider fulfillment Provider name + fulfillment ID
Interaction channel Agent-sourced artifacts carry an optional interaction_channel field: voice, text_chat, or voice_and_text. This field is null for non-agent actors (psp, fulfillment_provider, direct_web layers).

2.5 Sealing Model

The chain is sealed at the authorization layer. Sealing means:

  • The current_hash of the authorization artifact is stored as sealed_bundle_hash on the transaction chain record
  • sealed_bundle_hash is immutable once set — no update path exists
  • Only fulfillment artifacts may be appended post-seal, via the async late-arrival append path
  • The fulfillment artifact includes the sealed authorization hash in its chain, so any post-seal fulfillment record is still cryptographically bound to the sealed chain
Late-arrival fulfillment Fulfillment artifacts often arrive asynchronously after the chain is sealed (shipping events, delivery confirmations). Implementors must support appending fulfillment artifacts post-seal. The sealed_bundle_hash must not be invalidated by post-seal fulfillment appends.

2.6 Protocol Interoperability

AEP is protocol-agnostic. It does not replace or compete with the emerging agentic commerce protocols — it wraps them. Every AEP artifact carries a protocol field identifying which protocol carried the handshake it represents, and a protocol_metadata sub-object carrying the protocol-specific payload (signatures, mandates, session IDs, tool call records).

Supported protocols (v1.0.1):

Protocol Owner Path Position What It Carries
TAPVisaAgent ↔ MerchantSigned agent-domain-operation identity assertion
AP2GoogleAgent ↔ PSP (via Merchant)User-signed Cart / Intent Mandate (VDC)
ACPOpenAI + StripeAgent ↔ MerchantCheckout session lifecycle with Stripe payment primitive
UCPGoogleAgent ↔ MerchantCanonical checkout intent abstraction
MCPAnthropicAgent ↔ MerchantTool invocation (calls and results)
x402Open standardAgent ↔ Merchant / PSPHTTP-native payment challenge/response
A2AOpen standardAgent ↔ Agent (upstream)Agent-to-agent coordination metadata
GENERICFallbackTransactions with no standard protocol present
Normative schema location Protocol handshakes attach to the delegation artifact (see §3.9 Delegation & Protocol Metadata). That section defines the protocol_metadata payload schema, the five protocol sub-wrappers, the verification requirements, and the S/A/B/C/D evidence strength ranking. Implementations SHOULD consult §3.9 for field-level requirements.

Multi-protocol chains. A single transaction MAY carry multiple protocols simultaneously — for example, TAP for agent identity + AP2 for consumer authorization + ACP for session binding. AEP captures all three in one delegation artifact. This composition is the strongest possible evidence configuration and is RECOMMENDED whenever the participating protocols are available.

Cross-protocol witness. Because AEP wraps rather than replaces these protocols, an AEP chain is the only evidence structure that records which protocol(s) carried a given transaction. This produces a cross-protocol interoperability record that no single protocol produces on its own, and provides the primary signal for the evidence strength ranking defined in §3.9.12.

Fallback behavior. Transactions that occur without any standard agentic protocol in play (for example, a consumer completing a traditional web checkout with no agent involvement) MUST set protocol to GENERIC and MAY omit the delegation artifact entirely. In this case, the chain proceeds directly from intent to policy.

2.7 Cross-Artifact Required Fields

The following fields MUST appear on every artifact in every chain, regardless of type. They establish chain identity, scoping, and deterministic ordering. Implementations MAY carry the chain-level fields (chain_id, merchant_id, session_id_hash, spec_version) at the bundle level rather than duplicating them per artifact; the normative canonical-JSON hash input MUST include them either way.

Field Type Description Scope
chain_id string (UUID) Globally unique identifier for the transaction chain this artifact belongs to. Chain-level
merchant_id string The merchant whose chain this is. All verification MUST scope queries by this value — a bundle referencing a merchant_id the verifier does not recognize MUST be rejected. Chain-level
session_id_hash string sha256:... HMAC-SHA256 of the internal session token with a per-merchant server-side salt. Never the raw token. Chain-level
spec_version string AEP specification version the artifact conforms to (e.g. aep-1.0.1). Verifiers MUST refuse to verify a chain whose spec_version they do not support. Chain-level
seq integer ≥ 1 Sequential position of this artifact in the chain. Per-artifact
type string (enum) Artifact type (discovery | referral | intent | delegation | policy | cart | authorization | fulfillment). Per-artifact
actor string (enum) The party whose action this artifact records. Per-artifact
signing_actor string (enum) The party (or combined parties) that cryptographically signed the artifact. May differ from actor — e.g. a user-initiated referral is signed by the merchant's server. Per-artifact
captured_at string (ISO 8601 UTC) When the artifact was captured. MUST be monotonically non-decreasing across the chain. Per-artifact
idempotency_key string Stable key used to deduplicate retries of the same logical event. Verifiers MAY use this to detect replay attempts. Per-artifact payload
previous_hash string sha256:... SHA-256 of the preceding artifact. null for the genesis artifact. Per-artifact (hash chain)
current_hash string sha256:... SHA-256 of this artifact's canonical JSON (with current_hash itself excluded from the hash input). Per-artifact (hash chain)
Secrets never in payloads Session tokens, auth cookies, API keys, PSP secret keys, and any equivalent credential MUST NEVER appear in an artifact payload. Evidence bundles are designed to be exportable to third parties; any secret in a payload becomes abuse-capable on export. Use session_id_hash and payment_method_token-style references instead.

2.8 Signal Classification

Every field in every artifact payload has a signal class that tells dispute reviewers, regulators, and downstream systems how much weight to place on the field in evidentiary use. Signal classification is a first-class AEP concept and MUST be preserved on export. The four classes are:

Class Meaning Examples Representment weight
Deterministic Verifiable by independent re-computation, returned by a trusted system (PSP webhook, platform webhook, signed API), or computed from two deterministic inputs. network_transaction_id, charge_id, auth_code, avs_result, delivery_address_hash, risk_score. Full weight — treated as fact.
Attested Cryptographically signed by a party with standing — user (via WebAuthn or AP2 VDC), merchant (via JWKS-published key), PSP, agent (via TAP). AP2 ap2_user_signature, TAP tap_signature, merchant session_binding co-signature. Full weight when signature verifies against the published public key.
Inferred Reconstructed from observable signals (referrer headers, URL parameters, behavioral heuristics) rather than proven. Best-effort attribution. Discovery platform (inferred from referrer/params), attribution_confidence, consumer_ip_country from IP geolocation. Partial weight — acknowledged as attribution, not proof.
Asserted Unsigned claim by one party (usually the merchant) with no independent corroboration. Weakest signal; included for completeness but MUST NOT be relied on alone. Discovery citation_position (only available if agent reports it), quantity (unless AP2-signed). Weakest — merchant's word.

Classification is per-field, not per-artifact. A single artifact MAY carry fields of multiple classes — for example, the Authorization artifact's network_transaction_id is Deterministic, while fraud_score is Deterministic but dependent on the PSP's engine, and hypothetical custom merchant fields would be Asserted. Implementations MUST propagate the signal class through exports (§6) so representment reviewers see it.

Strengthening signals is an implementation goal. A chain with many Attested and Deterministic fields is evidentiarily stronger than one with many Asserted fields. §3.9.12 defines an evidence strength tier (S/A/B/C/D) derived from the Delegation artifact's signal composition; future AEP revisions MAY extend the tier calculation across the full chain.


3. Artifact Types

Each artifact type defines the required and optional payload fields, the permitted actor types, and the position in the commerce journey sequence.

3.1 Discovery Artifact

The discovery artifact bridges the citation monitoring system into the evidence chain. It records the moment an AI platform surfaced a merchant product in a consumer-facing response — before any click, referral, or purchase event.

Why discovery matters for disputes Card network reviewers examining a chargeback on an AI-mediated transaction can trace the chain back to the specific AI platform, query, and product citation that originated the journey. This is the layer that makes agentic commerce disputes provable — not just to the PSP, but to the card network itself.

Payload Schema

{
  // Inferred — the AI platform attribution
  "platform":               "'chatgpt' | 'gemini' | 'perplexity' | 'copilot' | 'meta' (required
                             if at least one of platform or product_url_cited present)",
  "attribution_method":     "'url_params' | 'merchant_tracked_link' | 'referrer_header' |
                             'behavioral_heuristic' (required)",
  "attribution_confidence": "'high' | 'medium' | 'low' (required) — deterministic by
                             attribution_method: url_params + merchant_tracked_link = high,
                             referrer_header = medium, behavioral_heuristic = low",

  // Deterministic — product citation
  "product_url_cited":      "string — URL as it appeared in the AI response (required)",
  "citation_position":      "number — rank in AI response (asserted; only available if agent
                             reports it)",

  // Asserted — the consumer's query (only if agent leaks it; rare)
  "query_hash":             "string — 'sha256:...' of the query; raw query never stored (optional)",

  // Cross-artifact required fields
  "captured_at":            "string — ISO 8601 UTC (required)",
  "idempotency_key":        "string — stable per-discovery-event key (required)"
}
// Unknown fields are stripped by the reference implementation (strict validation).

AI Platform Coverage

ChatGPT Google Gemini Perplexity Microsoft Copilot

The discovery artifact captures product citations from all major AI chat platforms that drive agentic commerce traffic. Platform-specific notes:

Platform Referrer Signal Primary Attribution Reliability
ChatGPT Inconsistent — often stripped by OpenAI referral_param (tracked URL), behavioral_heuristic Medium. Referrer unreliable; behavioral matching required.
Google Gemini May pass google.com referrer referrer_header, referral_param High when referrer is present; supplement with behavioral signals.
Perplexity Typically passes referrer header referrer_header, referral_param High. Perplexity referrer signals are more consistent than ChatGPT.
Microsoft Copilot May pass bing.com referrer referral_param, referrer_header Medium. Bing Shopping integration improves signal when active.

Actor Constraints

Permitted actor types for discovery artifacts: agent (when the AI platform citation is detected via synthetic monitoring or the citation system), merchant (when the discovery event is triggered via a merchant-controlled tracked link).

3.2 Referral Artifact

Records the inbound session event — the consumer clicking through from the AI platform citation to the merchant's site. Links the discovery artifact to the on-site session.

🚫
Never place session tokens in artifact payloads An evidence bundle is designed to be exportable to PSPs, card networks, and dispute platforms. Any secret placed in a payload becomes abuse-capable when the bundle is shared. This artifact carries session_id_hash (an HMAC of the session token and a per-merchant server-side salt) — never a raw session token. The same rule applies to auth cookies, API keys, and PSP secret keys.

Payload Schema

{
  // Deterministic — generated server-side on session start
  "referral_event_id":    "string — UUID of the agentic_referral_event row (required)",
  "referrer_domain":      "string — observed Referer header domain, if present (optional)",

  // Deterministic — pseudonymized; HMAC-SHA256 with per-merchant salt
  "consumer_ip_hash":     "string — 'sha256:...' (required)",
  "consumer_ip_country":  "string — ISO 3166-1 alpha-2 (required)",
  "user_agent_hash":      "string — 'sha256:...' (required)",

  // Deterministic — consent signals captured at the moment of session start
  "consent_gpc":          "boolean — Global Privacy Control header value (required)",
  "consent_cookie":       "'granted' | 'denied' | 'unset' (required)",

  // Deterministic — product context
  "product_id":           "string — product cited in the AI response (optional)",

  // Cross-artifact required fields
  "captured_at":          "string — ISO 8601 UTC (required)",
  "idempotency_key":      "string — stable per-request key (required)"
}
Removed in v1.0.1 Two fields from earlier drafts have been removed. session_token is replaced by session_id_hash (now carried at the chain level, §2.7, so it's present on every artifact without being duplicated in each payload). agent is removed as redundant — the AI platform attribution belongs in the discovery artifact (§3.1), not duplicated on every referral.

Actor & Signing

Permitted actor type: user. The consumer's actor ID is HMAC-SHA256(consumer_ip, per-merchant-salt) — a pseudonymized identifier that cannot be reversed to a real IP address. Artifact signing actor: merchant (the merchant's referral-tracking endpoint records and signs the event).

3.3 Intent Artifact

Records the consumer's or agent's explicit purchase intent — the specific product selected and configured before cart addition. When an AP2 Intent Mandate is present, its signature MUST be captured in the Delegation artifact (§3.9) rather than duplicated here.

Payload Schema

{
  // Deterministic identifiers
  "intent_id":          "string — UUID, stable per-intent (required)",
  "product_id":         "string (required)",
  "product_name":       "string (required)",
  "variant_id":         "string — merchant SKU or variant ID (optional)",
  "quantity":           "number, integer ≥ 1 (required)",

  // Deterministic pricing — captured at the moment of intent
  "unit_price":         "integer — minor units (e.g. cents), avoids float precision (required)",
  "currency":           "string — ISO 4217, e.g. 'USD' (required)",
  "price_displayed_at": "string — ISO 8601 UTC when the price was shown to the consumer (required)",

  // Optional agent-mediated context
  "query_hash":         "string — 'sha256:...' of the consumer's spoken/typed query if captured (optional)",

  // Cross-artifact required fields
  "captured_at":        "string — ISO 8601 UTC (required)",
  "idempotency_key":    "string — stable per-request key (required)"
}

Permitted actor types: user, agent. Artifact signing actors: agent + user + merchant. The merchant's server signs the artifact wrapper (always). When AP2 is in use, the user-signed Intent Mandate is carried inside the artifact and contributes a user signature attesting to the natural-language purchase intent. When TAP is in use, the agent contributes a domain-bound identity attestation that the agent observed and relayed this intent. The wrapper signature alone (merchant) is conformant for v1.0.1 deployments without AP2 or TAP; agent and user signatures SHOULD be present where the underlying protocols are deployed and are RECOMMENDED for full evidentiary strength.

3.4 Policy Artifact

Records the outcome of the merchant's policy engine evaluation. The policy check MUST occur after intent (and after delegation, if present) and before authorization. Implementors MUST never authorize a transaction without a preceding policy artifact.

Payload Schema

{
  // Deterministic — merchant's engine output
  "decision_id":          "string — UUID of this specific policy decision (required)",
  "policy_engine_vendor": "string — e.g. 'a-comm', 'sift', 'kount', 'internal' (required)",
  "policy_version":       "string — e.g. '2026.04.17' (required)",
  "outcome":              "'approved' | 'blocked' | 'escalated' (required)",
  "escalated":            "boolean (required)",
  "risk_score":           "number 0–100, integer (required)",
  "rules_triggered":      "array of strings — rule identifiers that fired (required, may be empty)",
  "reason":               "string — required if outcome is 'blocked' or 'escalated'",
  "evaluated_at":         "string — ISO 8601 UTC when the policy engine returned (required)",

  // Cross-artifact required fields
  "captured_at":          "string — ISO 8601 UTC (required)",
  "idempotency_key":      "string — stable per-decision key (required)"
}

Actor type and signing actor: merchant. In pilot deployments without a full policy engine, this artifact is auto-generated by the reference implementation with outcome: "approved", policy_engine_vendor: "a-comm", policy_version: "default-v1", risk_score: 0, and rules_triggered: [].

3.5 Cart Artifact

Records the consumer's explicit cart confirmation — the final review step before checkout. The confirmed: true field plus the matching AP2 Cart Mandate signature (carried in §3.9 Delegation) are the dispute-resolution signals that demonstrate the consumer (or their agent acting with consent) explicitly approved the cart contents before payment.

Addresses must be hashed, not stored raw Shipping and billing addresses are PII and MUST NOT appear in payload fields as raw strings. Use sha256(canonical_address_string + per-merchant-salt). The hash enables address-match verification against the fulfillment artifact (§3.7 delivery_address_hash) and the authorization artifact's AVS result, without exposing the address itself when the bundle is shared.

Payload Schema

{
  // Deterministic identifiers
  "cart_id":               "string — UUID (required)",
  "confirmed":             "boolean — MUST be true (required)",

  // Deterministic cart composition
  "items":                 "array of items, each with:
                              { product_id, product_name, variant_id,
                                quantity, unit_price (minor units) }  (required)",
  "subtotal":              "integer — minor units (required)",
  "shipping":              "integer — minor units (required)",
  "tax":                   "integer — minor units (required)",
  "discounts":             "integer — minor units, non-negative (required)",
  "total":                 "integer — minor units; MUST equal
                              subtotal + shipping + tax − discounts (required)",
  "currency":              "string — ISO 4217 (required)",

  // Deterministic addresses (hashed, not raw)
  "shipping_address_hash": "string — 'sha256:...' (required)",
  "billing_address_hash":  "string — 'sha256:...' (required)",

  // Deterministic payment credential reference (PSP-issued token only)
  "payment_method_token":  "string — PSP token, never PAN (required)",

  // Deterministic timestamps
  "cart_confirmed_at":     "string — ISO 8601 UTC (required)",

  // Cross-artifact required fields
  "captured_at":           "string — ISO 8601 UTC (required)",
  "idempotency_key":       "string — stable per-cart key (required)"
}

Permitted actor types: user, agent. Artifact signing actors: agent + user + merchant. The merchant's server signs the artifact wrapper (always). When AP2 is in use, the user-signed Cart Mandate (carried in §3.9 Delegation) contributes a user signature binding the consumer to the specific cart contents and total. When TAP is in use, the agent contributes a domain-bound identity attestation that the agent composed or relayed this cart on the user's behalf. The wrapper signature alone (merchant) is conformant for v1.0.1 deployments without AP2 or TAP; agent and user signatures SHOULD be present where the underlying protocols are deployed and are RECOMMENDED for full evidentiary strength. The total integrity check (subtotal + shipping + tax − discounts = total) is a verification requirement — mismatch fails §5 verification.

3.6 Authorization Artifact

Records the PSP authorization result. This artifact is the seal point. Its current_hash becomes sealed_bundle_hash on the transaction chain. The fields in this artifact are specifically chosen to map to card-network representment evidence schemas (Visa CE 3.0, Mastercard First Chargeback evidence, Stripe Evidence API, Adyen RevenueProtect) so exports in §6 can be produced with no schema translation loss.

🚫
PCI-DSS: No raw card data permitted Authorization artifact payloads MUST never contain PANs, CVVs, full magnetic stripe data, or any digit sequence that passes the Luhn algorithm. Implementations MUST validate payload fields at ingestion and reject any payload containing a PAN pattern. The only permitted payment-credential reference is a PSP-issued opaque token. card_last4 is explicitly permitted as it is not a PAN and is returned by all major PSPs as dispute metadata.

Payload Schema

{
  // Deterministic — PSP transaction identifiers
  "psp":                     "string — e.g. 'stripe', 'adyen', 'square', 'braintree' (required)",
  "payment_intent_id":       "string — PSP intent/session ID (required if applicable)",
  "charge_id":               "string — PSP charge/payment ID (required)",
  "payment_method_token":    "string — PSP-issued token, never PAN (required)",
  "payment_method_type":     "'card' | 'apple_pay' | 'google_pay' | 'klarna' | 'affirm' |
                              'afterpay' | 'ach' | 'sepa' | 'wallet_other' (required)",

  // Deterministic — authorization outcome
  "result":                  "'approved' | 'declined' | 'review' (required)",
  "amount":                  "integer — minor units; MUST match cart.total (required)",
  "currency":                "string — ISO 4217 (required)",
  "auth_code":               "string — issuer-returned authorization code (required if approved)",
  "authorized_at":           "string — ISO 8601 UTC (required)",

  // Deterministic — CARD NETWORK REPRESENTMENT FIELDS (critical for dispute defense)
  "network_transaction_id":  "string — the card-network-assigned transaction ID (NTI).
                              Visa CE 3.0, Mastercard First Chargeback, and Compelling
                              Evidence 3.0 workflows all key on this field. (required
                              for card transactions)",
  "card_brand":              "'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'unionpay' (required for card)",
  "card_last4":              "string — last 4 digits of PAN, PSP-returned (required for card)",
  "card_funding":            "'credit' | 'debit' | 'prepaid' | 'unknown' (optional)",
  "card_country":            "string — ISO 3166-1 alpha-2 of issuing country (optional)",

  // Deterministic — authentication and risk results from issuer/network
  "avs_result":              "'Y' | 'A' | 'N' | 'U' | 'R' | 'S' | 'Z' | 'W'
                              (AVS response code; Y = full match — required for card)",
  "cvv_result":              "'M' | 'N' | 'U' | 'P' | 'S' (CVV2 response code;
                              M = match — required for card)",
  "three_ds_result":         "'authenticated' | 'attempted' | 'frictionless' |
                              'failed' | 'not_supported' | 'not_applicable' (required for card)",
  "three_ds_version":        "string — e.g. '2.2.0' (required when three_ds_result ≠ 'not_applicable')",

  // Deterministic — fraud decisioning output (if the PSP ran its own engine)
  "fraud_score":             "number — PSP's fraud score (e.g. Stripe Radar score) (optional)",
  "fraud_engine":            "string — e.g. 'stripe_radar', 'adyen_revenueprotect' (optional)",

  // Cross-artifact required fields
  "captured_at":             "string — ISO 8601 UTC (required)",
  "idempotency_key":         "string — PSP's idempotency key (required)"
}
Representment-field coverage by PSP All 14 card-network fields in this schema are returned in the standard webhook or API response from Stripe (payment_intent.succeeded + payment_method.card), Adyen (AUTHORISATION notification), Square (payment.updated), and Braintree. Implementations MUST capture every field the PSP returns; fields the PSP omits should be set to null rather than missing. §6 Dispute Evidence Export describes the field-by-field mapping to Visa CE 3.0, Mastercard First Chargeback, and Stripe Evidence API.

Actor type and signing actor: psp. The artifact is produced by the PSP webhook handler and is the seal point for the chain. Any non-card payment method (Klarna, Affirm, Afterpay, ACH, SEPA, wallet) MAY omit the card_*, avs_*, cvv_*, and three_ds_* fields, but MUST set them to null (not omit) so canonical JSON serialization is stable.

3.7 Fulfillment Artifact

Records the fulfillment provider's shipping and delivery data. This artifact may arrive asynchronously after the chain is sealed and MUST be accepted via the late-arrival append path (see §2.5 Sealing Model). Proof of delivery to an address matching the authorization is one of the strongest representment signals in card-network dispute workflows — this artifact carries the evidence required to produce that proof.

Payload Schema

{
  // Deterministic identifiers
  "fulfillment_id":           "string — UUID (required)",
  "platform_order_id":        "string — merchant-platform order ID, e.g. Shopify GID (required)",

  // Deterministic shipping data
  "carrier":                  "string — e.g. 'ups', 'fedex', 'usps', 'dhl' (required)",
  "tracking_number":          "string (required)",
  "tracking_url":             "string — publicly accessible carrier URL (optional)",
  "status":                   "'pending' | 'in_transit' | 'delivered' | 'failed' | 'returned' (required)",
  "shipped_at":               "string — ISO 8601 UTC (required when status ≥ in_transit)",
  "delivered_at":             "string — ISO 8601 UTC (required when status = delivered)",

  // Deterministic address-match evidence (representment-critical)
  "delivery_address_hash":    "string — 'sha256:...' of canonical delivery address (required)",
  "delivery_address_match":   "boolean — MUST equal
                                 (delivery_address_hash === cart.shipping_address_hash) (required)",
  "signature_captured":       "string — recipient signature when carrier provides it (optional)",
  "proof_of_delivery_url":    "string — carrier-provided POD document URL (optional)",

  // Cross-artifact required fields
  "captured_at":              "string — ISO 8601 UTC (required)",
  "idempotency_key":          "string — stable per-fulfillment-event key (required)"
}

Actor type: fulfillment_provider. Signing actors: fulfillment_provider (carrier-attested) + merchant (wrapper). The merchant's server signs the artifact wrapper. The fulfillment provider contributes attested data — tracking number, delivery confirmation, proof-of-delivery URL, signature-captured boolean — sourced from the carrier's API or, where the carrier exposes signing infrastructure, a direct carrier signature on the data subset. When fulfillment is handled by the merchant's own logistics (no third-party carrier), the merchant signs both wrapper and data; signing_actor is then merchant alone.

delivery_address_match: true is the single most valuable representment signal a chargeback reviewer looks for when the dispute reason is "item not received." Its value is deterministic — computed from two already-present hashes — and cannot be forged without breaking the hash chain upstream.

3.8 Artifact Type Reference

The "Permitted Actors" column below lists the actor_type values an artifact may carry — the entity whose action the artifact records. This is distinct from signing_actor (which entity or entities cryptographically signed the artifact); signing-actor configurations are described in each per-artifact subsection above and summarized in §2.2 of the public summary.

Type Seq. Transaction Types Permitted Actors Seal point? Post-seal?
discovery 1 ai_referral_* agent, merchant No No
referral 2 ai_referral_* user No No
intent 3 or 1 all user, agent No No
policy 4 or 2 all merchant No No
cart 5 or 3 all user, agent No No
authorization 6 or 4 all psp Yes No
fulfillment 7 or 5 all fulfillment_provider No Yes

3.9 Delegation & Protocol Metadata

Normative addition — introduced v1.0.1, stabilized in v1.1.0 The delegation artifact type and its protocol_metadata payload record the handshake between the agent and the merchant that authorizes the transaction. This is where the agentic commerce protocols (TAP, AP2, ACP, UCP, MCP, x402, A2A) are captured in the evidence chain.

3.9.1 Purpose

The delegation artifact records four claims simultaneously:

  • Agent identity — which agent is operating (TAP-signed when available)
  • Consumer authorization — that the consumer delegated purchase authority to the agent (AP2 user-signed mandate when available)
  • Merchant acceptance — that the merchant accepted the handshake and bound the session (ACP session ID, UCP checkout binding)
  • Protocol provenance — which protocol(s) carried the handshake, for downstream dispute weighting

3.9.2 Chain Position

The delegation artifact sits after intent and before policy. Sequence:

discovery → referral → intent → delegation → policy → cart → authorization → fulfillment

Delegation MAY be omitted for transactions with no agentic protocol in play (traditional web checkout). When omitted, the chain proceeds directly from intent to policy and any protocol metadata is carried forward on the intent artifact as a fallback.

3.9.3 Permitted Actors

  • agent — primary producer of the delegation artifact
  • merchant — co-signer when merchant acceptance is captured in the same artifact
  • credentials_provider — co-signer when an AP2 Credentials Provider is in the chain

Every delegation artifact MUST be signed by at least one actor. Multi-signature delegation (agent + merchant + credentials_provider) is RECOMMENDED when the underlying protocols support it.

3.9.4 protocol_metadata Payload Schema

The delegation artifact's payload contains a required protocol_metadata object. Each protocol has a defined sub-wrapper. Multiple sub-wrappers MAY coexist in the same artifact (for example, TAP + AP2 + ACP on the same transaction).

Top-level schema
{
  "artifact_type": "delegation",
  "payload": {
    "protocol_metadata": {
      "protocol": "string",                  // enum, see §3.9.5
      "protocol_version": "string",          // SemVer of the carrying protocol
      "captured_at": "string (ISO 8601)",    // when the handshake occurred
      "agent_identity":       { ... } | null,  // §3.9.6
      "consumer_authorization":{ ... } | null, // §3.9.7
      "session_binding":      { ... } | null,  // §3.9.8
      "tool_invocation":      { ... } | null,  // §3.9.9
      "http_payment":         { ... } | null,  // §3.9.10
      "raw_protocol_payload": "string"       // base64; opaque fallback
    }
  }
}
3.9.5 protocol enum

Exactly one of: TAP, AP2, ACP, UCP, MCP, x402, A2A, GENERIC. When multiple protocols are present, the value of protocol is the dominant protocol — the one that carried the primary handshake — and the other protocols' payloads appear in their respective sub-wrappers. Dominance order (highest to lowest) is AP2 > TAP > ACP > UCP > MCP > x402 > A2A > GENERIC.

3.9.6 agent_identity — TAP wrapper
{
  "tap_signature": "string",         // JWS compact serialization
  "tap_public_key_url": "string",    // agent registry JWKS URL
  "tap_key_id": "string",
  "tap_domain": "string",            // merchant domain the agent operates on
  "tap_operation": "string",         // e.g., "payment", "checkout"
  "tap_session_id": "string"
}

All fields REQUIRED when agent_identity is present. The tap_signature MUST be independently verifiable against the published JWKS at tap_public_key_url.

3.9.7 consumer_authorization — AP2 wrapper
{
  "ap2_mandate_type": "CartMandate | IntentMandate",
  "ap2_mandate_id": "string (UUID)",
  "ap2_user_signature": "string",                  // VDC signature (JWS)
  "ap2_user_public_key_url": "string",             // DID or JWKS URL
  "ap2_credentials_provider_signature": "string",  // optional CP co-sign
  "ap2_credentials_provider_url": "string",        // optional
  "ap2_mandate_body": "string"                     // canonical JSON of signed mandate
}

The ap2_user_signature MUST verify against ap2_mandate_body using the key at ap2_user_public_key_url. When a Credentials Provider co-signs, both signatures MUST verify.

3.9.8 session_binding — ACP / UCP wrapper
{
  "session_protocol": "ACP | UCP",
  "session_id": "string",
  "merchant_acceptance_signature": "string",   // merchant signs session creation
  "merchant_public_key_url": "string",
  "session_created_at": "string (ISO 8601)",
  "session_state": "created | updated | completed | canceled"
}
3.9.9 tool_invocation — MCP wrapper
{
  "mcp_server_name": "string",
  "mcp_tool_name": "string",
  "mcp_arguments": { ... },        // JSON object
  "mcp_invocation_id": "string",
  "mcp_result_hash": "string"      // SHA-256 of tool result
}
3.9.10 http_payment — x402 wrapper
{
  "x402_challenge": "string",      // HTTP 402 challenge header value
  "x402_response": "string",       // client response token
  "x402_endpoint": "string (URL)",
  "x402_nonce": "string"
}

3.9.11 Verification Requirements

  1. Every non-null sub-wrapper's signatures MUST be independently verifiable against the public keys referenced by the wrapper's URL fields.
  2. Timestamps in sub-wrappers MUST be within 24 hours of the delegation artifact's top-level captured_at. Violations fail verification.
  3. When agent_identity is present, the tap_domain MUST match the merchant domain on file for this chain.
  4. When consumer_authorization is present, the ap2_mandate_body MUST reference the same item(s) and amount(s) as the subsequent cart artifact in the chain. Mismatch fails verification.
  5. The raw_protocol_payload field, when present, is opaque to AEP verification and is preserved for downstream tooling.

3.9.12 Evidence Strength Ranking

For dispute weighting, AEP defines an evidence strength score for delegation artifacts based on which sub-wrappers are populated and verify successfully:

ConfigurationStrengthNotes
TAP + AP2 + session_binding (all verify)Strongest (S-tier)Full delegation chain with agent identity, consumer mandate, and merchant acceptance
AP2 + session_bindingA-tierConsumer mandate present without TAP agent identity
TAP + session_bindingB-tierAgent identity present without AP2 user mandate
session_binding onlyC-tierMerchant-signed session only
GENERIC (no sub-wrappers)D-tierProtocol-less transaction; delegation artifact may be omitted

Dispute evidence exports (§6) SHOULD surface the strength tier to reviewers. This ranking is deterministic and may be recomputed from any archived delegation artifact.


4. Cryptographic Hash Chain

4.1 Hash Formula

The current_hash of every artifact is computed as SHA-256 over the canonical JSON representation of the artifact's hash input. All fields that contribute to the hash are listed below:

current_hash = SHA256(canonical_json({
  actor_id,           // normalized actor identifier
  actor_type,         // 'user' | 'agent' | 'merchant' | 'psp' | 'fulfillment_provider'
  artifact_type,      // 'discovery' | 'referral' | ... | 'fulfillment'
  interaction_channel, // 'voice' | 'text_chat' | 'voice_and_text' | null
  metadata,           // {protocol, sdk_version, merchant_id, session_id, ...} | null
  payload,            // type-specific payload object
  previous_hash,      // SHA256 of preceding artifact | null (genesis only)
  timestamp           // ISO8601 UTC — RFC3339 'Z' format enforced
}))
Canonical JSON JSON keys are sorted lexicographically. Timestamps are normalized to RFC3339 UTC format (trailing 'Z'). No whitespace. The canonical representation must be deterministic across all environments — identical inputs must produce identical hash output in CI, staging, and production.

The hash is output as a hex-prefixed string: sha256:<64-character lowercase hex>.

previous_hash must be inside the input The previous_hash field must be included inside the hash input object — not treated as a side reference. This is what makes the chain sequential and tamper-evident. Any implementation that computes the hash without previous_hash in the input is non-conformant and produces an undetectable chain break vulnerability.

Hash Output Format

sha256:a3f1c8b0e2d4f6a1b3c5e7f9a1b3c5e7f9a1b3c5e7f9a1b3c5e7f9a1b3c5e7f9

4.2 Genesis Artifact

The first artifact in any chain is the genesis artifact. Its distinguishing property is that previous_hash is null. All subsequent artifacts must have a non-null previous_hash equal to the current_hash of the immediately preceding artifact.

Property Genesis (seq = 1) Non-genesis (seq > 1)
sequence_number 1 N (monotonically increasing)
previous_hash null Required — current_hash of artifact at seq N-1
Chain link verification N/A — no predecessor Must verify previous_hash == preceding.current_hash

4.3 Ed25519 Server Signature

Every artifact carries a required Ed25519 server signature over its current_hash. The signature is stored as a separate field (server_signature) on the artifact record and is never included in the hash input itself.

server_signature = Ed25519Sign(private_key, current_hash)

The corresponding Ed25519 public key is published by the implementing party (A-Comm Inc. or any independent implementor) to allow third-party verification without access to the private key.

🚫
Signature is always required Unsigned artifacts are non-conformant. An AEP dispute bundle that contains artifacts without server signatures cannot be presented as a complete evidence chain. Verification implementations must treat missing signatures as a verification failure.

Verification Steps (per artifact)

  1. Recompute current_hash from the artifact's hash input fields
  2. Assert recomputed hash equals stored current_hash (constant-time comparison)
  3. Verify Ed25519 server_signature against the stored current_hash using the published public key
  4. Verify previous_hash equals current_hash of the preceding artifact (except genesis)

5. Verification

Full chain verification produces a structured result with four independent sub-checks:

Check Field How verified Failure meaning
Hash chain integrity hash_chain_intact For every artifact (seq > 1): current_artifact.previous_hash == preceding.current_hash An artifact was inserted, deleted, or reordered
Hash recomputation part of valid For every artifact: recompute hash from fields and compare to stored current_hash An artifact's content was modified after creation
Signature validity signatures_valid For every artifact: verify Ed25519 signature against current_hash using published public key Artifact was not signed by the claimed authority, or key mismatch
Chain completeness chain_complete total_artifacts == expectedArtifactCount(transaction_type) Expected artifact layers are missing (chain may still be valid)

Verification Result Schema

{
  "valid": boolean,              // true only if hash_chain_intact AND signatures_valid AND all hashes verify
  "hash_chain_intact": boolean,
  "signatures_valid": boolean,
  "chain_complete": boolean,     // expected artifact count met
  "artifacts_verified": number,  // count of successfully verified artifacts
  "errors": ["string"]           // human-readable error messages if valid = false
}
chain_complete is informational A chain can be valid: true and chain_complete: false simultaneously — this occurs when not all expected artifact layers have been appended yet (e.g., a fulfillment artifact has not arrived). Verification is a point-in-time check. The chain remains valid even if not all layers are present.

6. Dispute Evidence Export

An AEP dispute bundle (DisputeBundle) is the complete export of a transaction chain for representment submission. It contains the full artifact sequence, verification result, merchant context, and export timestamp.

6.1 DisputeBundle Schema

{
  "transaction": {
    "id": "string",
    "transactionType": "ai_referral_agent_session" | ...,
    "status": "string",
    "interactionChannel": "voice" | "text_chat" | "voice_and_text" | null,
    "createdAt": "ISO8601",
    "completedAt": "ISO8601 | null",
    "sealedBundleHash": "sha256:... | null"
  },
  "verification": {
    "valid": boolean,
    "hashChainIntact": boolean,
    "signaturesValid": boolean,
    "chainComplete": boolean,
    "artifactsVerified": number,
    "errors": ["string"]
  },
  "artifacts": [EhcArtifactRecord],  // ordered by sequence_number ASC
  "merchantContext": {
    "merchantId": "string",
    "merchantName": "string",
    "totalValue": "string | null",
    "currency": "string | null"
  },
  "exportedAt": "ISO8601"
}

6.2 Chain Re-verification on Export

Before generating a dispute bundle, implementations must re-verify the full chain. Any verification failure must be surfaced in the bundle's verification object rather than silently omitted. A dispute bundle with verification.valid = false must be flagged before submission.


7. Discovery Attribution

Because AI platforms do not provide reliable referral signals, AEP uses a layered attribution model combining deterministic and probabilistic methods to identify the AI citation that originated a commerce journey.

7.1 Platform Coverage

AEP natively supports four AI platforms as discovery sources. Each platform has distinct referrer behavior that affects which attribution methods are reliable:

Platform Value (platform field) Referrer behavior Recommended primary method
ChatGPT chatgpt Frequently strips referrer header referral_param or behavioral_heuristic
Google Gemini gemini May pass google.com referrer referrer_header + referral_param
Perplexity perplexity Consistently passes referrer referrer_header
Microsoft Copilot copilot May pass bing.com referrer referral_param + referrer_header

7.2 Attribution Methods

The attribution_method field on the discovery artifact records how the AI citation was linked to the inbound session:

Method Description Confidence Dispute weight
referral_param URL parameter (e.g., ?acomm_agent=chatgpt) injected into product URLs distributed via structured data and feeds. Deterministic — the parameter was present in the inbound URL. Deterministic Highest
merchant_tracked_link Merchant-controlled link with signed tracking token. Deterministic. Deterministic Highest
referrer_header HTTP Referer header from the AI platform domain. Present when the platform sends referrer data. High High
behavioral_heuristic Session behavior pattern (direct landing on product page, no prior navigation, session timing consistent with AI-mediated click). Probabilistic. Probabilistic Supporting
Attribution method and dispute weight Deterministic methods (referral_param, merchant_tracked_link) produce the strongest dispute evidence. Probabilistic methods (behavioral_heuristic) are supporting signals that corroborate but cannot independently establish attribution. Include all available signals in the discovery artifact payload — do not discard lower-confidence signals when higher-confidence signals are present.

7.3 Session Linkage Chain

Connecting a discovery artifact to a payment authorization requires the ehc_transaction_id to propagate through the consumer's browser session. The reference implementation uses the following linkage chain:

1.  Consumer arrives via AI citation
        → POST /v1/events/referral (referral tracking script)
        → EHC transaction created; discovery + referral artifacts appended
        → Response includes: { ehc_transaction_id: "txn_..." }
        → Store: sessionStorage.setItem("acomm_ehc_transaction_id", id)
                 + cookie: acomm_ehc=txn_...; SameSite=None; Secure

2.  Consumer adds product to cart
        → Shopify Web Pixel: analytics.subscribe("product_added_to_cart", ...)
        → POST /v1/ehc/artifacts  { artifact_type: "intent", ... }
          Auth: X-Acomm-Session header (session token, not cookie)
        → Intent artifact appended (seq 3)

3.  Consumer proceeds to checkout
        → Shopify Checkout Extension (purchase.checkout.block.render)
        → useCartLines() + useTotalAmount() → cart artifact payload
        → POST /v1/ehc/artifacts  { artifact_type: "cart", confirmed: true, ... }
        → Cart artifact appended (seq 5 or 3)
        → Sets Shopify order metafield: acomm_ehc_transaction_id = txn_...

4.  Consumer pays
        → Stripe PaymentIntent created with metadata:
            { acls_ehc_transaction_id: "txn_...", acls_account_id: "acc_..." }
        → payment_intent.succeeded webhook fires
        → Authorization artifact appended + chain sealed

The ehc_transaction_id is the single token that ties all four steps together. Implementations must propagate it from the initial referral response through to the Stripe PaymentIntent metadata. Loss of this token at any step results in an incomplete chain.


8. Implementation Notes

8.1 Immutability Enforcement

AEP artifacts must be append-only. The storage layer must enforce immutability at the database level — application-layer enforcement alone is insufficient because it can be bypassed by direct database access or administrative operations.

Recommended PostgreSQL implementation

-- Prevent mutation of immutable fields
CREATE OR REPLACE FUNCTION prevent_ehc_artifact_mutation()
RETURNS TRIGGER AS $$
BEGIN
  RAISE EXCEPTION
    'ehc_artifacts rows are immutable. Attempted update on id=% field=%',
    OLD.id, TG_OP;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER ehc_artifacts_immutability_update
  BEFORE UPDATE ON ehc_artifacts
  FOR EACH ROW EXECUTE FUNCTION prevent_ehc_artifact_mutation();

-- Prevent deletion
CREATE OR REPLACE FUNCTION prevent_ehc_artifact_delete()
RETURNS TRIGGER AS $$
BEGIN
  RAISE EXCEPTION
    'ehc_artifacts rows are immutable and cannot be deleted. id=%', OLD.id;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER ehc_artifacts_immutability_delete
  BEFORE DELETE ON ehc_artifacts
  FOR EACH ROW EXECUTE FUNCTION prevent_ehc_artifact_delete();

Implementors must also ensure that sealed_bundle_hash on the transaction chain record is set once and never updated. Apply a CHECK constraint or trigger on the column to enforce this.

8.2 PII and Privacy

AEP is designed to be PII-minimal. The following rules apply to all artifact payloads:

  • Consumer actor IDs must be pseudonymized using HMAC-SHA256 with a per-merchant secret salt: HMAC-SHA256(user_id, per_merchant_salt). Never store raw user IDs in artifact payloads.
  • Email addresses, names, and physical addresses must not appear in artifact payloads. Destination addresses in fulfillment artifacts must be redacted to postal code only.
  • Session tokens in discovery/referral payloads must be time-limited (maximum 24 hours), merchant-scoped, and verifiable — never raw session identifiers.
  • The entire artifact chain must be exportable without exposing any PII that could identify the consumer to a third-party reviewer.

8.3 PCI-DSS Compliance

Authorization artifact payloads must never contain primary account numbers (PANs), CVVs, full magnetic stripe data, or any value that passes the Luhn algorithm.

Luhn check enforcement

Implementations must validate authorization payloads at ingestion using a Luhn check against all digit sequences of 13–19 digits. Any payload field containing a PAN-like pattern must be rejected before the artifact is created:

// PAN detection pattern
const PAN_REGEX = /\b(\d[ -]?){13,19}\b/g;

function passesLuhn(digits: string): boolean {
  const d = digits.replace(/\D/g, '');
  let sum = 0;
  let odd = false;
  for (let i = d.length - 1; i >= 0; i--) {
    let n = parseInt(d[i], 10);
    if (odd) { n *= 2; if (n > 9) n -= 9; }
    sum += n;
    odd = !odd;
  }
  return sum % 10 === 0;
}

function containsRawPaymentCredentials(payload: Record<string, unknown>): boolean {
  const text = JSON.stringify(payload);
  const matches = text.match(PAN_REGEX) ?? [];
  return matches.some(m => passesLuhn(m.replace(/\D/g, '')));
}

The only permitted payment credential field is payment_token_reference — an opaque PSP-issued token that references a stored payment method without containing any card data.

8.4 Idempotency

Artifact creation must be idempotent. Implementations must derive idempotency keys deterministically from the artifact's identifying properties, allowing retries without duplicate artifact creation:

idempotency_key = SHA256(
  transaction_id + ":" +
  artifact_type  + ":" +
  actor_id       + ":" +
  floor(timestamp_ms / 60000)  // 60-second window
)

The idempotency key must be stored with a UNIQUE constraint on the artifacts table. A duplicate key violation on insert should return the existing artifact rather than raising an error.

8.5 Data Retention

Evidence chain data must be retained long enough to support dispute resolution, audit, and regulatory review. AEP specifies the following retention model:

Minimum retention Default retention Maximum retention Rationale
12 months 24 months 24 months Card network chargeback windows (120 days) + appeals (18 months) + SOC2 audit cycles

The retention_until timestamp is computed when the transaction is closed (completed_at is set): retention_until = completed_at + 730 days. Implementations should schedule automated deletion after this date.


9. A-Comm's Position in the Transaction Flow

A-Comm Inc. is the maintainer of the AEP reference implementation and the primary evidence custodian for merchants using the A-Comm platform. A-Comm is adjacent to the payment path, not in it. A-Comm is the black box recorder for agentic commerce — parallel to the transaction, never gating it. A-Comm does not move money, authorize charges, or hold funds. PSPs and card networks remain in the payment path. A-Comm is the evidence capture layer attached to every step.

Scope of this section This section describes the operational and regulatory positioning of A-Comm Inc. as the reference AEP implementer. It is non-normative with respect to the protocol itself — any party may implement AEP in any transaction position. The positioning rules below apply to A-Comm's own deployment.

9.1 Transaction Flow Diagram

┌────────────────────────────────────────────────────────────────────────────────┐
│                       PAYMENT PATH (in the flow)                              │
│                                                                               │
│  Consumer → AI Agent & Protocol → Merchant → PSP → Network → Issuer           │
└──────────────────────────────────────┬────────────────────────────────────────┘
                                     │
                        Reads events from every step
                                     │
┌──────────────────────────────────────▼────────────────────────────────────────┐
│                     A-COMM EVIDENCE LAYER (adjacent)                          │
│                                                                               │
│  Discovery → Referral → Intent → Policy → Cart → Authorization → Fulfillment  │
│                                                                               │
│  Hash-chained, cross-network, dispute-grade evidence bundle                   │
└─────────────────────────────────────────────────────────────────────────────────┘

9.2 Positioning by Phase

PhaseA-Comm's PositionWho Owns the Path
Pre-authorizationIn the decision flow (Merchant Policy Engine consulted before auth)A-Comm (policy)
Authorization itselfFully adjacent — evidence observer onlyPSP
Post-authorizationIn the evidence flow (receives auth result, seals bundle per §2.5)A-Comm (evidence)
Settlement / clearingNot involvedNetwork + Issuer
Dispute / representmentEvidence provider only (per §6) — does not manage workflowPSPs + dispute mgmt platforms

9.3 What AEP / A-Comm Is NOT

The AEP reference implementation, and A-Comm Inc. as its primary operator, is explicitly not in any of the following categories:

Not a money transmitter. The implementation never holds, routes, or settles funds. No MTL required in any U.S. state.
Not a payment processor. The implementation does not authorize charges, settle transactions, or clear funds. PSPs own that.
Not in PCI-DSS scope for card data. The implementation never touches raw card data. Tokenization only, via the merchant's existing PSP SDK. PCI handling rules are defined normatively in §8.3.
Not a dispute manager. AEP generates and delivers evidence (per §6 Dispute Evidence Export). Dispute workflow management is owned by Chargebacks911, Midigator, Justt, Sift, and in-house merchant teams.
Not a fraud decisioning platform. AEP provides cryptographic proof, not decisions. Sift, Kount, and Signifyd make the call; AEP ensures evidence exists when the call is challenged.

9.4 Regulatory Classification

A-Comm operates in the observability and evidence infrastructure category — the same category as Datadog, Snowflake, and Segment. A-Comm is subject to:

  • CCPA and applicable U.S. state privacy laws (consumer data, DSRs within 45 days, published privacy policy)
  • Two-party consent state requirements for chat/voice recording (CA, FL, IL, MD, MA, MI, MT, NV, NH, OR, PA, WA)
  • FTC AI disclosure requirements (chat agent identifies itself as AI when sincerely asked)
  • SOC 2 compliance for evidence storage
  • GPC signal and consent cookie honoring in referral tracking (per §7.3 Session Linkage)

A-Comm is not subject to money transmitter licensing, PCI-DSS Level 1 scope (as an acquirer or processor), banking regulation, or Visa/Mastercard operating regulations for participants in the payment path.


Appendix A — Glossary

Term Definition
Artifact An immutable, cryptographically hashed record of a single event in the commerce journey. Seven artifact types are defined: discovery, referral, intent, policy, cart, authorization, fulfillment.
Transaction chain The ordered, append-only sequence of artifacts representing a single commerce transaction from discovery to fulfillment.
Genesis artifact The first artifact in a chain (sequence_number = 1). Its previous_hash is null.
Sealed bundle hash The current_hash of the authorization artifact, stored on the transaction chain record. Immutable once set. Marks the boundary between pre-seal and post-seal artifact appends.
AEP A-Comm Evidence Protocol. The A-Comm reference implementation uses the name AEP throughout the codebase.
DisputeBundle The complete exported artifact sequence plus transaction metadata, verification result, and merchant context. The unit of evidence submitted to PSPs and card networks.
canonical_json A deterministic JSON serialization with lexicographically sorted keys, RFC3339 UTC timestamps, and no whitespace.
previous_hash The current_hash of the immediately preceding artifact in the chain. Included inside the hash input (not as a side reference). null for genesis artifacts only.
Interaction channel The modality of the agent session: voice, text_chat, or voice_and_text. null for non-agent artifact layers.
Attribution method The mechanism used to link an AI platform citation to an inbound session: referral_param, merchant_tracked_link, referrer_header, or behavioral_heuristic.

Appendix B — JSON Schema Reference

The following is the TypeScript interface for the artifact hash input, which defines all fields that contribute to current_hash. This interface is the normative reference for hash computation.

interface ArtifactHashInput {
  artifact_type: ArtifactType;
  actor_type: ActorType;
  /**
   * Normalized actor identifier.
   * Users: HMAC-SHA256(id, per-merchant salt). Agents: name[:version].
   */
  actor_id: string;
  /**
   * null for non-agent artifact layers (psp, fulfillment_provider, direct_web).
   */
  interaction_channel: 'voice' | 'text_chat' | 'voice_and_text' | null;
  payload: Record<string, unknown>;
  metadata: Record<string, unknown> | null;
  /**
   * null ONLY for genesis artifact (sequence_number = 1).
   * Required and non-null for all subsequent artifacts.
   */
  previous_hash: string | null;
  /** ISO 8601 UTC string — 'Z' suffix required */
  timestamp: string;
}

type ArtifactType =
  | 'discovery' | 'referral' | 'intent' | 'policy'
  | 'cart' | 'authorization' | 'fulfillment';

type ActorType =
  | 'user' | 'agent' | 'merchant' | 'psp' | 'fulfillment_provider';

type TransactionType =
  | 'ai_referral_agent_session'
  | 'ai_referral_standard_checkout'
  | 'agent_session_only'
  | 'direct_web';

/** Expected artifact count for chain_complete verification */
function expectedArtifactCount(type: TransactionType): number {
  return (type === 'ai_referral_agent_session' ||
          type === 'ai_referral_standard_checkout') ? 7 : 5;
}

Appendix C — Stripe Evidence API Mapping

An AEP DisputeBundle maps directly to Stripe's Dispute Evidence API fields (stripe.com/docs/api/disputes/update). The following mapping is implemented in the reference implementation's stripe-formatter.ts.

Character limit Stripe caps each evidence field at approximately 1,500 characters. The reference implementation caps at 1,400 characters per field to leave headroom for Stripe's internal processing. Implementations must truncate gracefully — never mid-word or mid-hash.
Stripe field AEP source Content
customer_communication discovery + intent + cart artifacts (forward-chronological) Discovery artifact first: AI platform, consumer query, referral URL, attribution method, confidence score, hash. Then intent artifact: product, quantity, actor, channel, timestamp, hash. Then cart artifact: confirmed=true, item count, total, currency, hash. Together these form the complete "authorization trail" from AI citation through explicit cart confirmation.
shipping_documentation fulfillment artifact Carrier, tracking number, tracking URL, fulfillment status, shipped_at, delivered_at, artifact hash and previous hash. "No fulfillment artifact recorded" if the artifact has not yet arrived.
receipt authorization artifact + transaction header Transaction chain ID, transaction type, chain status at export, authorization timestamp, actor, payment token reference (not PAN), PSP name, authorization code, amount authorized, sealed bundle hash, artifact hash.
uncategorized_text Full chain summary Chain integrity verification result (valid/intact/signatures/complete/artifacts verified/errors), transaction ID/type/channel/timestamps, and the full artifact sequence table (sequence number, artifact type, actor type, hash prefix). Provides cryptographic context for card network reviewers.

Sample uncategorized_text output

A-COMM.AI EVIDENCE HASH CHAIN — VERIFICATION SUMMARY
Protocol: A-Comm Evidence Protocol (AEP) v1.0.1 (Apache 2.0)
Exported: 2025-06-15T14:22:07Z

-- CHAIN INTEGRITY --
Chain valid: YES
Hash chain intact: YES
Signatures valid: YES
Chain complete: YES
Artifacts verified: 7

-- TRANSACTION --
ID: txn_01HV4K8QZXMJF2B3C5D7E9FA
Type: ai_referral_agent_session
Channel: text_chat
Created: 2025-06-15T14:01:33Z
Completed: 2025-06-15T14:08:19Z

-- ARTIFACT SEQUENCE --
[1] discovery       actor=agent                hash=a3f1c8b0e2d4f6a1...
[2] referral        actor=user                 hash=b7d2e9f1a4c6b8d0...
[3] intent          actor=agent                hash=c1e3f5g7h9i1j3k5...
[4] policy          actor=merchant             hash=d2f4h6j8l0n2p4r6...
[5] cart            actor=agent                hash=e3g5i7k9m1o3q5s7...
[6] authorization   actor=psp                  hash=f4h6j8l0n2p4r6t8...
[7] fulfillment     actor=fulfillment_provider hash=g5i7k9m1o3q5s7u9...

Appendix D — Changelog

Version Date Changes
v1.0 2025 Initial public release. Defines: 7-artifact commerce journey (discovery, referral, intent, policy, cart, authorization, fulfillment); 2×2 transaction type matrix; sequential hash chain model with previous_hash inside hash input; Ed25519 server signature on every artifact; sealing model at authorization layer; post-seal fulfillment append path; discovery artifact with AI platform coverage (ChatGPT, Gemini, Perplexity, Copilot); 4-method attribution model; PCI-DSS Luhn enforcement; HMAC-SHA256 actor pseudonymization; idempotency key formula; PostgreSQL append-only trigger patterns; Stripe Evidence API mapping; 4-check verification protocol.
v1.0.1+++ 2026-04-23 Signing-actor strengthening to align normative sections with the public summary §2.2. §3.3 Intent: signing actors strengthened from merchant to agent + user + merchant — merchant signs the artifact wrapper (always), the user-signed AP2 Intent Mandate contributes a user signature when AP2 is in use, and TAP contributes an agent identity attestation when in use. Wrapper-only signing remains conformant for v1.0.1 deployments without AP2 or TAP. §3.5 Cart: signing actors strengthened from user+merchant (when AP2 Cart Mandate present) / merchant (otherwise) to agent + user + merchant with the same conformance allowance. §3.7 Fulfillment: signing actors clarified from fulfillment_provider to fulfillment_provider (carrier-attested) + merchant (wrapper) to match production reality where carriers expose tracking via API rather than direct cryptographic signing; merchant-fulfilled (no carrier) case unchanged at merchant alone. §3.8 Artifact Type Reference: added explanatory note disambiguating actor_type (Permitted Actors column) from signing_actor (described in per-artifact subsections). Public summary §2.2 table updated in matching commit. No breaking changes — signature-set strengthening is backward-compatible with v1.0.1 verification rules.
v1.0.1++ 2026-04-19 Partner-review hardening pass. Closes gaps that would be spotted immediately by a Visa, Mastercard, Stripe, Adyen, or Klarna reviewer inspecting the payloads. §2.7 Cross-Artifact Required Fields (new): defines chain_id, merchant_id, session_id_hash, spec_version, seq, type, actor, signing_actor, captured_at, idempotency_key, previous_hash, current_hash as MUST-appear on every artifact. Adds explicit "never place secrets in payloads" rule. §2.8 Signal Classification (new): defines four signal classes (Deterministic, Attested, Inferred, Asserted) as first-class AEP concepts that MUST be preserved on export. §3.2 Referral: critical fix — removed session_token (credential leak when bundles are exported); replaced with session_id_hash at chain level. Removed redundant agent field (attribution belongs in §3.1 Discovery). Added consumer_ip_hash, consumer_ip_country, user_agent_hash, consent_gpc, consent_cookie, referrer_domain, captured_at, idempotency_key. §3.3 Intent: added intent_id, variant_id, price_displayed_at, query_hash, captured_at, idempotency_key; changed unit_price to integer minor units. §3.4 Policy: added decision_id, policy_engine_vendor, rules_triggered, evaluated_at, captured_at, idempotency_key. §3.5 Cart: added cart_id, tax, discounts, shipping_address_hash, billing_address_hash, payment_method_token, cart_confirmed_at, captured_at, idempotency_key; added total integrity check (subtotal + shipping + tax − discounts = total); addresses MUST be hashed, not raw. §3.6 Authorization: major expansion adding card-network representment fields required by Visa CE 3.0, Mastercard First Chargeback, and Stripe Evidence API — payment_intent_id, charge_id, auth_code, network_transaction_id, card_brand, card_last4, card_funding, card_country, avs_result, cvv_result, three_ds_result, three_ds_version, fraud_score, fraud_engine, authorized_at. §3.7 Fulfillment: added fulfillment_id, delivery_address_hash, delivery_address_match, signature_captured, proof_of_delivery_url; delivery_address_match is a deterministic boolean computed against cart.shipping_address_hash. No breaking changes to §3.9 Delegation. No breaking changes to the hash chain algorithm.
v1.0.1+ 2026-04-19 Protocol interoperability and positioning additions. §2.6 Protocol Interoperability (new): declares AEP protocol-agnostic; defines supported protocol table (TAP, AP2, ACP, UCP, MCP, x402, A2A, GENERIC) with owner and path-position columns; specifies multi-protocol chain semantics and fallback behavior. §3.9 Delegation & Protocol Metadata (new, normative): defines the delegation artifact type; specifies its chain position (after intent, before policy); enumerates permitted actors (agent, merchant, credentials_provider); defines the protocol_metadata top-level payload schema; provides five protocol sub-wrapper schemas (agent_identity/TAP, consumer_authorization/AP2, session_binding/ACP-UCP, tool_invocation/MCP, http_payment/x402); specifies the protocol dominance ordering (AP2 > TAP > ACP > UCP > MCP > x402 > A2A > GENERIC); defines five verification requirements (signature verify, 24h timestamp skew, domain match, mandate-cart amount match, opaque raw_protocol_payload); introduces the S/A/B/C/D evidence strength ranking for dispute weighting. §9 A-Comm's Position in the Transaction Flow (new, non-normative): documents A-Comm's reference-implementation positioning as adjacent to payment path; includes transaction flow diagram; phase-by-phase positioning table; explicit "What AEP/A-Comm Is NOT" block covering money transmitter, payment processor, PCI scope, dispute manager, and fraud decisioning disclaimers; regulatory classification declaration (CCPA, two-party consent, FTC AI disclosure, SOC 2). Public summary: AEP spec split into a public summary (Abstract, §1, §2 Core Concepts, §9, Attribution Methodology appendix) and the full normative spec; pre-split v1.0.1 archived to aep-spec/archive/aep-spec-v1.0.1-pre-split-gated.html.
v1.0.1 2026-03-31 Reference implementation alignment. Payload schemas: per-artifact Zod validation schemas defined for all 7 artifact types (payload-schemas.ts). Policy artifact: step_up_requiredescalated; blocking_rule/step_up_typereason; added auto-generation note for pilot deployments without a policy engine. Referral artifact: corrected payload schema to match reference implementation (referral_event_id, session_token, product_id, agent, consent_given); corrected actor type from merchant to user (pseudonymized consumer IP). Discovery artifact: removed session_token and model_used fields (strict validation strips unknown fields); added meta to platform enum. Intent artifact: added optional unit_price and currency fields. Fulfillment artifact: updated status enum (pending, in_transit, returned added; processing/shipped consolidated); added platform_order_id. Stripe Appendix C: reordered customer_communication to forward-chronological (discovery → intent → cart). Session linkage: POST /v1/events/referral now returns ehc_transaction_id in response body, enabling session token propagation to Shopify Web Pixel and Checkout Extension. Database: agentic_referral_events.ehc_transaction_id (reverse FK) and transaction_chains.shopify_order_id added (migration 050).

A-Comm Evidence Protocol (AEP) v1.0.1 — Copyright 2026 A-Comm Inc. — Apache License 2.0 — Published by A-Comm Inc., contact@a-comm.ai