Signed purchase receipts for x402 purchases
Ed25519 signed purchase_receipt.v1 receipts for vet402 test purchases: the terms offered, the payment, a hash of the response and the outcome, tied to the daily ledger root.
What a receipt is
vet402 buys from x402 sellers with its own wallets and records each attempt (the L1 ledger). From 2026-12-01 on, each recorded purchase gets a purchase_receipt.v1. The receipt states the terms the seller offered, what vet402 paid, a hash of what came back, and the outcome. vet402 signs it with the same Ed25519 key that signs its API responses.
The signed bytes are the UTF-8 bytes of vet402-purchase-receipt.v1. followed by JCS (RFC 8785) of the receipt object. receipt_sha256 is sha256 of the same bytes. The prefix keeps a receipt signature apart from a response signature, which signs JCS of an object and starts with an opening brace.
In-flight attempts and settlements still waiting for the on-chain re-read get no receipt yet. When a row changes later (for example a settlement found on chain after the attempt), vet402 issues a new receipt for the new values. Its supersedes field names the receipt_sha256 of the earlier one. The receipt store refuses edits and deletes.
A receipt issued on a UTC day is a line purchase-receipt:v1:<receipt_sha256> at the end of that day's ledger payload, so the root of that day covers the receipts as well as the ledger rows. A receipt is a record of one purchase. The verdict receipt on GET /api/v1/check covers a verdict instead, and the evidence pack at /api/v1/evidence/{purchase_id} bundles one purchase for a dispute.
{
"type": "purchase_receipt.v1",
"receipt": {
"type": "purchase_receipt.v1",
"purchase_id": "0b8c2a52-6f5e-4c1a-9d2e-1f0a3b4c5d6e",
"resource_key": "seller.example/api/quote",
"method": "GET",
"network": "eip155:8453",
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"scheme": null,
"amount_quoted": "1000",
"amount_paid": "1000",
"pay_to": "0xcccc…",
"terms_hash": "x402-terms.v1:…",
"response_sha256": "…",
"response_bytes": 42,
"response_basis": "full_body",
"content_type_match": true,
"http_status": 200,
"outcome": "settled",
"delivery": "delivered",
"attempted_at": "2026-12-01T12:00:00.000000Z",
"rules_version": "…",
"payer_ref": { "kind": "address", "value": "0xaaaa…" },
"tx_ref": { "kind": "tx", "value": "0x1111…" },
"issued_at": "2026-12-02T01:00:00.000Z",
"supersedes": null
},
"receipt_sha256": "…",
"signature": { "alg": "ed25519", "kid": "…", "value": "…" },
"anchor": { "day": "2026-12-02", "line": "purchase-receipt:v1:…" }
}Fields
| Field | Part | Meaning |
|---|---|---|
purchase_id | record | The purchase row. The same id as purchase_id in export.csv and /api/v1/evidence/{purchase_id}. |
resource_key | promise | Host and path of the listing, the same value as resource_key in export.csv. |
method, network, asset, scheme | promise | The request method of the listing and the payment rail vet402 paid on. scheme is null in v1 because the ledger row does not record it yet. |
amount_quoted | promise | Base units the seller asked for on that attempt. |
pay_to | promise | The address the seller named to receive the payment. |
terms_hash | promise | x402-terms.v1: followed by sha256 of JCS of v, resource_key, method, network, asset, scheme, amount (amount_quoted) and pay_to. Anyone can recompute it from the receipt. |
amount_paid | payment | Base units vet402 re-read on chain as transferred. 0 until the settlement is confirmed on chain (confirmed_units in export.csv). |
payer_ref, tx_ref | payment | The paying wallet and the settlement transaction, as kind and value. value is null when there is none. |
http_status, content_type_match | response | The HTTP status of the paid request, and whether the content type matched the listing. |
response_sha256, response_bytes | response | sha256 and length of the paid response body, when vet402 read it to the end. The body itself is not published. |
response_basis | response | full_body when the hash covers the whole body. truncated or partial when the body was not read to the end. not_read when there was no paid body to read. |
outcome, delivery | outcome | outcome is the status column of export.csv. delivery is the delivery value of delivery.csv for settled rows, null otherwise. |
attempted_at | record | When the purchase was attempted, UTC to the microsecond, as in the daily ledger payload. |
rules_version | record | The vet402 decision rules in force when the receipt was issued. |
issued_at, supersedes | record | When vet402 issued the receipt, and the receipt_sha256 of the earlier receipt for the same purchase (null for the first one). |
Get receipts
GET /api/v1/receipts?url=<https URL>&limit=20returns the receipts for one listing, newest first (limit 1 to 100).GET /api/v1/receipts/<purchase_id>returns current and history for one purchase.GET /data/receipts/YYYY-MM-DD.jsonlreturns the receipts issued that UTC day, one JSON object per line, in the order of the lines in that day's ledger payload. CC BY 4.0. Each line also carries the three checks below in short form.POST /api/v1/receipts/verifywith a receipt as served checks the signature, receipt_sha256 and terms_hash on the server.
No API key is needed. Each route has a per-IP limit, listed in the API reference.
Check a receipt
- Signature. Build the bytes vet402-purchase-receipt.v1. followed by JCS of receipt, and check signature.value (base64url Ed25519) with the key in vet402-keys.json whose kid is signature.kid. The sha256 of the same bytes is receipt_sha256.
- Terms. Compute sha256 of JCS of the object v (x402-terms.v1), resource_key, method, network, asset, scheme, amount (the value of amount_quoted) and pay_to. terms_hash is x402-terms.v1: followed by that hex.
- Day root. Download the payload of anchor.day from /api/v1/observatory/anchors/day and find the line purchase-receipt:v1:<receipt_sha256>. sha256 of prevRoot (or genesis), a newline, and the payload bytes is the rootHash of that day on /api/v1/observatory/anchors, and the next sealed day names it as prevRoot.
The repository has an offline checker that needs node:crypto and node:fs and no npm package: scripts/verify-receipt.ts. It prints one PASS or FAIL line per check and exits 1 when a check fails.
curl -s https://vet402.com/.well-known/vet402-keys.json -o keys.json
curl -s "https://vet402.com/api/v1/receipts/<purchase_id>" | jq .current > receipt.json
curl -s "https://vet402.com/api/v1/observatory/anchors/day?day=<anchor.day>" -o day.txt
# rootHash and prevRoot of that day: GET https://vet402.com/api/v1/observatory/anchors
node scripts/verify-receipt.ts --receipt receipt.json --jwks keys.json \
--day-payload day.txt --prev-root <prevRoot or genesis> --root <rootHash>What it shows, and what it does not
A receipt that passes the three checks shows:
- vet402 recorded these values for this purchase at issued_at, signed with a key it publishes.
- The values have not changed since, because any change breaks the signature and receipt_sha256.
- The receipt existed when the daily ledger root of anchor.day was sealed, because its receipt_sha256 is a line of that day's payload.
- The terms in the receipt hash to terms_hash, so two receipts with the same terms_hash were offered the same terms.
It does not show:
- That the response content was correct or useful. vet402 publishes a hash of the body, not a judgment of its content.
- That the seller will deliver next time. A receipt describes one past purchase.
- That a seller agrees with the record. Disputes and corrections are listed at /api/v1/observatory/corrections.
- Anything about purchases vet402 did not make.
vet402 measures. It does not insure purchases.
Keys
Public keys are at /.well-known/vet402-keys.json. When vet402 rotates the key, the retiring public key stays in that file for at least 30 days, so receipts signed before the rotation stay checkable. Save a copy of the key file next to receipts you keep.