Docs
Schemav1.1.0

How WebReceipt works

A self-healing consumer evidence engine. It compiles public purchase journeys into one canonical Deal Contract, seals every claim with tamper-evident evidence, and verifies extraction against deterministic semantic invariants.

Core concepts

Deal Contract

One canonical economic schema (v1.1.0) compiled from any site: advertised price, checkout breakdown (base, fee items, mandatory fees, taxes, add-ons, discounts, final total), terms, the journey, and the evidence set — sealed with a contract hash.

Evidence

Each critical field carries a record: captured text, source URL, DOM path, journey step, collector version, timestamp and a SHA-256 hash. Screenshots are references, not proof — the hash is the proof.

Contract Integrity Engine

Eleven deterministic checks that catch wrong-but-valid extraction — where every field is populated but the numbers don't reconcile. A critical failure marks the contract invalid.

Deal Anomalies

Observed, not adjudicated: journey price increases, mandatory non-tax charges and taxes are surfaced as facts with context — never as legal conclusions.

Promise Diff

git diff for commercial promises. Compares two contracts and reports money, text, list and fee changes — e.g. 'Free cancellation' → 'Non-refundable'.

Self-Healing

When a redesign breaks extraction, an AI repair is proposed. WebReceipt treats the preview as untrusted: it must compile into the same Deal Contract and pass every critical invariant before it is approved and deployed.

Integrity checks

total_arithmeticbase + mandatoryFees + taxes + optionalAddons − discounts equals finalTotal
fee_breakdownSum of required fee items equals the mandatory-fee total
discount_boundsDiscounts never exceed gross charges
currency_consistencyEvery money field shares one currency
journey_monotonicityFinal price is plausible after discounts
critical_evidenceAdvertised price, base price, final total and cancellation all carry provenance
evidence_hashesEach evidence record hashes to its stored SHA-256
contract_hashThe whole Deal Contract hashes to its stored seal
evidence_linksEvery journey step resolves to a real evidence record
source_urlsEvidence sources are HTTP(S) URLs
journey_completeJourney has comparable start and end observations

API reference

All routes run on the Node.js runtime and drive the same engine that powers the Console. Bodies are JSON. In this app the collector behind them is the simulator; the Bright Data adapter is exercised by the sponsor harness and the CLI runbook.

POST/api/observe→ ObserveResult

Traverse the journey, compile the Deal Contract, run integrity and detect anomalies.

{ targetUrl?, mutation?="healthy", autoHeal?=false }
POST/api/heal→ ObserveResult

Observe with auto-heal on: propose a repair, verify the preview, then deploy if valid.

{ targetUrl?, mutation?="wrong-valid-total" }
POST/api/diff→ DiffResult

Diff two contracts — a simulated day +3, or the two most recent stored observations.

{ simulate?=true, targetUrl? }
POST/api/stress→ StressRun

Run the Chaos Checkout suite: inject mutations and measure detection and recovery.

{ mutations?: string[] }
GET/api/state→ StoreState

Stored contracts, events and stress runs.

POST/api/reset→ StoreState

Clear stored state and reset the simulator.

Run it locally

npm install
npm run dev        # Next.js console at http://localhost:3000
npm run verify     # engine checks: schema + unit tests + chaos suite

Ready to see it run?

Walk the full observe → break → heal → diff loop on live engine data.

Launch console