Third parties can read any existing diamonds.whereditgo.bazaar.purchase.receipt records stored on the user's (buyer's) own PDS to drive special effects.
See example receipt
If a user has purchased a good that is published on your site, a valid receipt could be used to gate content, show support badges, and more.
Verifying a purchase
By default, the DID document of a bazzar instance is served at https://<domain>/.well-known/did.json. - 1.
Resolve
storefrontDidto its DID document. Find the signing key inverificationMethod. Ifkidis present on the receipt, use the matching entry. If absent, try every non-revoked key. - 2.
Recompute
grantedItemsDigest: SHA-256 of thegrantedItemsarray with CIDs sorted lexicographically, base64url-encoded without padding. - 3.
Rebuild the payload string in this order, colon-delimited:
purchasedAt:payment.ref:purchasedGood.uri:listing.cid:buyerDid:licenseGrant.cid:grantedItemsDigest- 4.
Verify
storefrontSig(base64url) against the UTF-8 payload bytes using the key's algorithm. Bazaar uses ES256K by default. A receipt that passes is genuine and unmodified — if any of the seven fields were changed after signing, the payload won't match and verification fails. - 5.
Fetch the
catalog.listingrecord atlisting.uriand confirm its CID matcheslisting.cidon the receipt. This proves the price and license terms were not swapped after checkout.
Evaluating licensing
- 1.
Fetch the
license.termsrecord atlicenseGrant.uriand confirm its CID matcheslicenseGrant.cid. This is the exact text the buyer agreed to at checkout. If the merchant has edited the terms since, existing receipts are unaffected — the CID pins the version in force at the time of sale. - 2.
Fetch
purchasedGood.uri. For acatalog.product, confirm the item being gated appears ingrantedItemson the receipt. The product's currentitemslist is irrelevant —grantedItemsis frozen at checkout and is the only authoritative record of what the buyer owns.
Checking entitlement
After verification, check that the receipt covers the item or product you are evaluating:
For a single item:
purchasedGood.urimatches the item's AT-URI, or the item appears ingrantedItems.For a product:
purchasedGood.urimatches the product's AT-URI and the specific item the buyer is accessing appears ingrantedItems.
Pin to CIDs when you need an exact version. Use URIs alone when any version of the record satisfies the check.
Key rotation
Storefronts may rotate keys. Old receipts remain valid under the key that signed them. When a key is revoked, the DID document marks it with revoked: true and a revokedAt timestamp. A receipt signed before revokedAt by a revoked key is still valid; one signed after is not.
Do not cache the DID document indefinitely. Re-resolve periodically or on verification failure.