NIP‑102: Marketplace Receipt
draft optional
A standardized event for cryptographically verifiable marketplace receipts on Nostr. It bridges product listings (NIP‑99), payment proofs, and digital goods fulfillment (NIP‑98) into a complete, auditable commercial pipeline that does not rely on any central authority.
The kind:1020 Receipt Event
A Marketplace Receipt is a regular (non-replaceable) event of kind:1020. Its permanence is intentional: receipts are legal and financial records and MUST NOT be silently replaced or deleted by the issuing party.
The root event MUST be signed by:
- the merchant/developer key identified by the listing coordinate; or
- a fulfillment key authorized by the consuming protocol.
When a delegated fulfillment key signs the root, the event MUST contain an immutable authorization reference defined by the consuming protocol. A direct developer-signed receipt MUST omit that reference unless the consuming protocol explicitly permits a redundant self-reference.
Tags
| Tag | Value | Description |
|---|---|---|
order |
<order-id> |
Unique public order identifier. Required. |
p |
<customer-pubkey> |
Buyer public key. Required and indexed. |
a |
<30402-coordinate> |
Purchased listing coordinate. Required. |
authorization |
<authorization-root-event-id> |
Required when the root is signed by a delegated fulfillment key; absent for direct developer signing. |
payment_hash |
<32-byte-hex> |
Canonical Lightning payment hash to which all supplied payment proofs and the merchant attestation bind. Required. |
amount_msat |
<integer> |
Amount attested as paid, in millisatoshis. Required for Lightning payments. |
settled_at |
<unix-seconds> |
Merchant-attested settlement time. Required on the root. It is signed metadata, not a time derivable from a preimage. |
proof |
zap, <event-id> |
Declares a publicly verifiable NIP-57 Zap Receipt proof. Repeatable only for distinct proof forms or identifiers. |
proof |
bolt11-preimage |
Declares that BOLT-11/preimage supporting evidence exists in encrypted content and was validated by the issuer. |
r |
<external-receipt-url> |
Optional HTTPS URL to a human-readable receipt authenticated via NIP-98. |
status |
paid | fulfilled | refunded | disputed |
Root MUST use paid. |
currency |
ISO 4217 or ticker | Optional display denomination. It MUST NOT contradict amount_msat when both represent the same Lightning payment. |
amount |
Numeric string | Optional display amount in currency. |
e |
<preceding-receipt-event-id> |
Reserved exclusively for receipt status-chain predecessors. Absent on the root; required exactly once on updates. |
A root receipt MUST NOT use an e tag for a Zap Receipt. Zap proofs are identified through proof tags so receipt-chain traversal has one unambiguous predecessor namespace.
Encrypted content
The .content field MUST contain NIP-44-encrypted JSON to the buyer, using the receipt-signing key as sender. It is therefore readable by the buyer and by the issuing fulfillment key holder. Arcadestr or another client reads it only through the buyer’s active signer; fulfillment private keys MUST NOT be shared with clients.
Suggested plaintext:
{
"order_id": "<same as order tag>",
"items": [
{
"product_id": "<listing d-tag>",
"name": "Example Product",
"quantity": 1,
"unit_price": "49.99",
"currency": "USD"
}
],
"subtotal": "49.99",
"tax": "4.50",
"shipping": "0.00",
"total": "54.49",
"currency": "USD",
"bolt11": "lnbc...",
"preimage": "<32-byte-hex>",
"settlement_metadata": {},
"notes": "Digital delivery"
}
No encrypted field is required for ordinary third-party ownership verification. Raw payment evidence is retained for elevated verification, audit, or dispute handling.
Root example
{
"kind": 1020,
"pubkey": "<developer-or-fulfillment-pubkey>",
"created_at": 1700000000,
"tags": [
["order", "order_3f7a2b9c"],
["p", "<customer-pubkey>"],
["a", "30402:<developer-pubkey>:my-product-uuid"],
["authorization", "<kind-30406-root-id>"],
["payment_hash", "<32-byte-hex>"],
["amount_msat", "1000000"],
["settled_at", "1700000000"],
["proof", "bolt11-preimage"],
["status", "paid"]
],
"content": "<NIP-44 encrypted JSON>",
"id": "<event-id>",
"sig": "<signature>"
}
Experimental aggregate-payment profile (version 1)
The root shape above remains the normative legacy single-payment shape. This optional extension describes multiple Lightning payments without invalidating historical receipts. It is experimental and does not allocate new event kinds.
An aggregate root adds exactly one payment_set tag:
["payment_set", "1", "<gross-msat>", "<canonical-sha256>"]
and one ordered tag for every positive leg:
["payment_leg", "<leg-id>", "<role>", "<recipient-pubkey>", "<amount-msat>", "<payment-hash>", "<proof-type>", "<proof-reference>", "<accepted-terms-id-or-empty>"]
It also adds sale_listing with the exact immutable kind:30402 event ID,
sale_quote with the signed private quote event ID, and sale_processor with
the operator announcement pubkey (an optional historical URL may follow). The
usual a, p, order, status, and delegated authorization rules still
apply. An aggregate root MUST omit the legacy singular payment_hash,
amount_msat, and proof tags so parsers cannot mistake one profile for the
other.
role is developer or operator. Leg order is ascending amount, then role,
then recipient pubkey. canonical-sha256 is lowercase SHA-256 of canonical
versioned JSON containing the version, gross, and the complete ordered leg
array. It commits all displayed fields, including accepted terms IDs. A verifier
MUST reject a zero leg, duplicate leg ID, duplicate payment hash/proof replay,
unknown role/proof declaration, malformed hash, inconsistent proof, unordered
legs, or a checked sum unequal to gross. Every declared proof MUST validate at
issuance and bind the actual recipient, exact amount, invoice/payment hash, and
purchase context; one valid leg cannot rescue another.
For the ADP version-1 profile, “actual recipient” is a processor attestation to invoice provenance, not a fact established by a preimage. The processor MUST have fetched the invoice itself from the listing- or accepted-terms-bound LNURL destination and retained its endpoint, callback, LSP metadata, amount, and hash. The signed quote and aggregate root bind that provenance. Optional NIP-57 request/receipt evidence is additional provider attestation, not mandatory Lightning consensus proof. Refund proofs use the same model against the buyer-authorized refund destination.
Raw invoices, preimages, refund destinations, LNURL callbacks, and private recovery details remain in NIP-44 encrypted content. Public recipient and amount bindings enable portable verification but reveal the revenue split and correlate buyer, listing, processor, and payment hashes. Issuers and clients MUST disclose this privacy tradeoff before use. Ordinary distribution servers need only the signed public root, proof declarations/references, listing anchor, and the consuming protocol’s authorization lifecycle; they need no private key and need not decrypt content.
The exact sale_listing freezes ordinary listing edits and terms changes for the
sale. A hard delegated-authority cancellation defined by the consuming protocol
remains authoritative and may prevent issuance. Existing receipts, status
chains, direct/delegated signer rules, and legacy ownership verification remain
unchanged.
Payment evidence and merchant attestation
A root receipt is the authorized merchant-side attestation that payment was accepted for the identified buyer and listing. It does not claim neutral, trustless observation of the Lightning Network.
A BOLT-11 invoice and matching preimage establish only cryptographic consistency:
sha256(preimage) == invoice.payment_hash
That relation alone does not independently prove payer identity, payment path, recipient identity, or settlement time. settled_at is an issuer-signed assertion.
A receipt MUST declare at least one proof form. Every proof supplied or declared at issuance MUST validate, and all supplied proofs MUST describe the same payment. They MUST agree on at least:
payment_hash;- amount;
- buyer association where represented;
- listing or order association where represented;
- non-contradictory settlement state.
A valid proof MUST NOT rescue another malformed, invalid, or contradictory proof.
Public Zap proof
For ['proof', 'zap', '<event-id>'], the referenced kind:9735 event MUST validate under NIP-57 and the consuming protocol’s LSP-resolution rules. Its payment hash and amount MUST agree with the root receipt.
Encrypted BOLT-11/preimage evidence
For ['proof', 'bolt11-preimage'], the issuer MUST have validated the encrypted invoice and preimage before signing. Ordinary ownership verification relies on the signed receipt. During elevated verification, the buyer MAY decrypt and selectively disclose the invoice and preimage to a verifier over NIP-98-authenticated HTTPS.
The disclosure request MUST be bound to a verifier nonce or request hash to prevent reuse in another verification session. The verifier MUST check the disclosed evidence against the immutable public receipt fields.
No universal Arcadestr reader key and no shared fulfillment private key are defined. Multi-recipient envelope encryption is outside this version.
Order Status Lifecycle
The root receipt MUST use status: paid, contain no predecessor e, and be unique for its order value.
Each status update MUST:
- use the same
order,p,a, and rootauthorizationvalue; - contain exactly one
ereferencing the immediate precedingkind:1020event; - contain exactly one allowed
status; - be signed by a transition-authorized key under the consuming protocol.
Clients MUST resolve the unique structurally valid chain tip. They MUST NOT choose an event merely because it has the greatest created_at. Forks, cycles, changed invariant fields, invalid signatures, and unreachable descendants are invalid.
#order filtering depends on relay support for multi-character tag indexing. Clients SHOULD use it when supported, but MUST fall back to #p and local order filtering.
["REQ", "order-sub", {
"kinds": [1020],
"#order": ["order_3f7a2b9c"]
}]
Purchase Detection
Because p tags are indexed by relays, any client can subscribe to receipts addressed to a specific buyer without polling every merchant’s relay:
["REQ", "<sub‑id>", {
"kinds": [1020],
"#p": ["<customer‑pubkey>"]
}]
Clients SHOULD decrypt the .content field locally after retrieval and MUST NOT forward the plaintext to any third party without explicit user consent.
Proof of Ownership
A resolved receipt chain constitutes Proof of Ownership when:
- Every event signature and chain invariant is valid.
- The root
pmatches the buyer. - The root
amatches the claimed listing coordinate. - The unique chain tip has a status accepted by the consuming protocol, normally
paidorfulfilled. - The root signer is either the developer encoded in
a, or a delegated fulfillment key whose immutableauthorizationreference validates under the consuming protocol at the root’screated_at. - Every publicly supplied proof validates and all proof forms agree.
- The public payment binding is internally consistent.
The signed receipt is the normal portable ownership credential. A third-party server does not need to decrypt raw payment evidence for ordinary authorization.
A verifier that cannot retrieve enough relay data to establish the receipt chain or delegated authorization MUST treat the result as indeterminate or unavailable, not as cryptographic proof of invalidity.
Integration with NIP‑98 for Digital Goods Fulfillment
For digital products (software, media, API tokens), purchase detection MUST trigger automated fulfillment. The flow is:
- Buyer authenticates to the merchant’s fulfillment server by presenting a signed
kind:27235event (NIP‑98) that includes the order ID as a parameter (e.g.?order=order_3f7a2b9c). - Fulfillment server queries relays for a
kind:1020event with#ordermatching that order ID and#pmatching the buyer’s pubkey. - The server MUST resolve the receipt chain and validate Proof of Ownership, including delegated authorization when present. It MUST NOT require decryption of raw payment evidence during ordinary ownership verification.
- If validation passes, the server delivers the digital good or issues a license token.
- The server SHOULD publish a fulfillment status update: a new
kind:1020event with the sameordertag, anetag pointing to the paid receipt, and the tag["status", "fulfilled"].
Verified Buyer Reviews
A review event (kind:1985) MAY include a pointer to a kind:1020 receipt to assert that the reviewer is a verified buyer:
{
"kind": 1985,
"tags": [
["L", "com.nostr.marketplace.review"],
["l", "verified‑purchase", "com.nostr.marketplace.review"],
["e", "<kind:1020‑receipt‑event‑id>"],
["a", "30402:<merchant‑pubkey>:product‑uuid"]
],
"content": "Excellent product, fast delivery.",
...
}
Clients rendering reviews SHOULD:
- Resolve the referenced
kind:1020event. - Confirm its
pubkey(merchant) matches the reviewed listing’s author. - Confirm the
atag in the receipt matches the listing being reviewed. - Confirm the
ptag matches the review author’s pubkey. - Confirm the payment proof is valid as per Proof of Ownership.
Reviews that pass all five checks SHOULD be displayed with a Verified Purchase indicator.
Privacy Considerations
- The
.contentfield MUST be encrypted with NIP‑44. The deprecated NIP‑04 MUST NOT be used. - Relay operators see the receipt and its public ownership/payment-binding tags, but not raw invoice, preimage, or itemized details.
- The
ptag exposes the buyer’s pubkey, which is a deliberate trade‑off to enable relay indexing. For strongly private transactions, receipts MAY be wrapped in NIP‑59 Gift Wrap and delivered directly to the buyer, but then they cannot be discovered via#pqueries. - Merchants SHOULD transmit
kind:1020events over relays that enforce authenticated writes (NIP‑42) to prevent spoofed receipts. - Buyers SHOULD verify the merchant’s pubkey against a trusted NIP‑05 identifier before accepting a receipt as authoritative.
Relationship to Other NIPs
| NIP | Role in the Receipt Flow |
|---|---|
| NIP‑99 | Classified listings (kind:30402) — the offer |
| NIP‑57 | Zap Request/Receipt (kind:9734/kind:9735) — optional payment proof |
| NIP‑44 | Encryption of itemized content in .content |
| NIP‑98 | HTTP Auth (kind:27235) for digital goods fulfillment |
| NIP‑05 | Merchant identity verification |
| NIP‑42 | Relay authentication to prevent spoofed receipts |
| NIP‑59 | Gift Wrap for encrypted P2P order negotiation and private receipts |
Implementation Notes
- Kind number:
1020is a regular (non‑replaceable, non‑ephemeral) event kind. Relays MUST store these events permanently. - Relay storage: Relays SHOULD store
kind:1020events for as long as feasible. Merchants and buyers SHOULD retain their own copies to guarantee auditability. - Merchant key hygiene: Merchants SHOULD use a dedicated keypair for signing receipts, separate from their social identity key, to limit exposure in the event of key compromise.
- Idempotency: Merchants MUST NOT publish more than one initial
kind:1020event for the sameordertag value. Status updates are new events that reference the previous one via anetag. - Order ID format: The
ordertag value SHOULD be a version 4 UUID, but any string that uniquely identifies the order within the merchant’s domain is acceptable.
Reference Implementation Checklist
For a client or merchant backend to be considered NIP‑102 compliant it SHOULD implement:
- Publishing a unique root merchant attestation with public buyer, listing, payment-hash, amount, settlement, status, proof, and delegated-authorization bindings.
- Encrypting raw invoice, preimage, and itemized details with NIP-44 to the buyer.
- Validating every supplied payment proof and rejecting contradictions.
- Resolving receipt status structurally and using
#pplus local filtering when#orderis unavailable. - Requiring an immutable authorization root for every delegated receipt.
- Supporting nonce-bound selective disclosure for elevated verification without sharing private keys.
- Including the order ID in NIP-98 fulfillment requests and resolving the complete ownership credential.
- Displaying a Verified Purchase indicator only after complete receipt verification.