upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/15.md
diff options
context:
space:
mode:
Diffstat (limited to '15.md')
-rw-r--r--15.md83
1 files changed, 61 insertions, 22 deletions
diff --git a/15.md b/15.md
index f8df328..68d28ff 100644
--- a/15.md
+++ b/15.md
@@ -4,11 +4,11 @@ NIP-15
4Nostr Marketplace (for resilient marketplaces) 4Nostr Marketplace (for resilient marketplaces)
5----------------------------------- 5-----------------------------------
6 6
7`draft` `optional` `author:fiatjaf` `author:benarc` `author:motorina0` `author:talvasconcelos` 7`draft` `optional` `author:fiatjaf` `author:benarc` `author:motorina0` `author:talvasconcelos`
8 8
9> Based on https://github.com/lnbits/Diagon-Alley 9> Based on https://github.com/lnbits/Diagon-Alley
10 10
11> Implemented here https://github.com/lnbits/nostrmarket 11> Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market)
12 12
13## Terms 13## Terms
14 14
@@ -33,13 +33,13 @@ The `merchant` admin software can be purely clientside, but for `convenience` an
33## `Merchant` publishing/updating products (event) 33## `Merchant` publishing/updating products (event)
34 34
35A merchant can publish these events: 35A merchant can publish these events:
36| Kind | | Description | NIP | 36| Kind | | Description |
37|---------|------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------| 37| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
38| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). | [NIP01 ](https://github.com/nostr-protocol/nips/blob/master/01.md) | 38| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). |
39| `30017` | `set_stall` | Create or update a stall. | [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md) (Parameterized Replaceable Event) | 39| `30017` | `set_stall` | Create or update a stall. |
40| `30018` | `set_product` | Create or update a product. | [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md) (Parameterized Replaceable Event) | 40| `30018` | `set_product` | Create or update a product. |
41| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md) | 41| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
42| `5 ` | `delete` | Delete a product or a stall. | [NIP09](https://github.com/nostr-protocol/nips/blob/master/09.md) | 42| `5 ` | `delete` | Delete a product or a stall. |
43 43
44### Event `30017`: Create or update a stall. 44### Event `30017`: Create or update a stall.
45 45
@@ -54,8 +54,8 @@ A merchant can publish these events:
54 { 54 {
55 "id": <String, UUID of the shipping zone, generated by the merchant>, 55 "id": <String, UUID of the shipping zone, generated by the merchant>,
56 "name": <String (optional), zone name>, 56 "name": <String (optional), zone name>,
57 "cost": <float, cost for shipping. The currency is defined at the stall level>, 57 "cost": <float, base cost for shipping. The currency is defined at the stall level>,
58 "countries": [<String, countries included in this zone>], 58 "regions": [<String, regions included in this zone>],
59 } 59 }
60 ] 60 ]
61} 61}
@@ -63,15 +63,18 @@ A merchant can publish these events:
63 63
64Fields that are not self-explanatory: 64Fields that are not self-explanatory:
65 - `shipping`: 65 - `shipping`:
66 - an array with possible shipping zones for this stall. The customer MUST choose exactly one shipping zone. 66 - an array with possible shipping zones for this stall.
67 - the customer MUST choose exactly one of those shipping zones.
67 - shipping to different zones can have different costs. For some goods (digital for example) the cost can be zero. 68 - shipping to different zones can have different costs. For some goods (digital for example) the cost can be zero.
68 - the `id` is an internal value used by the merchant. This value must be sent back as the customer selection. 69 - the `id` is an internal value used by the merchant. This value must be sent back as the customer selection.
70 - each shipping zone contains the base cost for orders made to that shipping zone, but a specific shipping cost per
71 product can also be specified if the shipping cost for that product is higher than what's specified by the base cost.
69 72
70**Event Tags**: 73**Event Tags**:
71```json 74```json
72 "tags": [["d", <String, id of stall]] 75 "tags": [["d", <String, id of stall]]
73``` 76```
74 - the `d` tag is required by [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md). Its value MUST be the same as the stall `id`. 77 - the `d` tag is required, its value MUST be the same as the stall `id`.
75 78
76### Event `30018`: Create or update a product 79### Event `30018`: Create or update a product
77 80
@@ -85,19 +88,33 @@ Fields that are not self-explanatory:
85 "images": <[String], array of image URLs, optional>, 88 "images": <[String], array of image URLs, optional>,
86 "currency": <String, currency used>, 89 "currency": <String, currency used>,
87 "price": <float, cost of product>, 90 "price": <float, cost of product>,
88 "quantity": <int, available items>, 91 "quantity": <int or null, available items>,
89 "specs": [ 92 "specs": [
90 [ <String, spec key>, <String, spec value>] 93 [<String, spec key>, <String, spec value>]
91 ] 94 ],
95 "shipping": [
96 {
97 "id": <String, UUID of the shipping zone. Must match one of the zones defined for the stall>,
98 "cost": <float, extra cost for shipping. The currency is defined at the stall level>,
99 }
100 ]
92} 101}
93``` 102```
94 103
95Fields that are not self-explanatory: 104Fields that are not self-explanatory:
105 - `quantity` can be null in the case of items with unlimited abailability, like digital items, or services
96 - `specs`: 106 - `specs`:
97 - an array of key pair values. It allows for the Customer UI to present present product specifications in a structure mode. It also allows comparison between products 107 - an optional array of key pair values. It allows for the Customer UI to present product specifications in a structure mode. It also allows comparison between products
98 - eg: `[["operating_system", "Android 12.0"], ["screen_size", "6.4 inches"], ["connector_type", "USB Type C"]]` 108 - eg: `[["operating_system", "Android 12.0"], ["screen_size", "6.4 inches"], ["connector_type", "USB Type C"]]`
99 109
100_Open_: better to move `spec` in the `tags` section of the event? 110 _Open_: better to move `spec` in the `tags` section of the event?
111
112- `shipping`:
113 - an _optional_ array of extra costs to be used per shipping zone, only for products that require special shipping costs to be added to the base shipping cost defined in the stall
114 - the `id` should match the id of the shipping zone, as defined in the `shipping` field of the stall
115 - to calculate the total cost of shipping for an order, the user will choose a shipping option during checkout, and then the client must consider this costs:
116 - the `base cost from the stall` for the chosen shipping option
117 - the result of multiplying the product units by the `shipping costs specified in the product`, if any.
101 118
102**Event Tags**: 119**Event Tags**:
103```json 120```json
@@ -109,8 +126,8 @@ _Open_: better to move `spec` in the `tags` section of the event?
109 ] 126 ]
110``` 127```
111 128
112 - the `d` tag is required by [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md). Its value MUST be the same as the product `id`. 129 - the `d` tag is required, its value MUST be the same as the product `id`.
113 - the `t` tag is as searchable tag ([NIP12](https://github.com/nostr-protocol/nips/blob/master/12.md)). It represents different categories that the product can be part of (`food`, `fruits`). Multiple `t` tags can be present. 130 - the `t` tag is as searchable tag, it represents different categories that the product can be part of (`food`, `fruits`). Multiple `t` tags can be present.
114 131
115## Checkout events 132## Checkout events
116 133
@@ -152,7 +169,7 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips
152``` 169```
153 170
154_Open_: is `contact.nostr` required? 171_Open_: is `contact.nostr` required?
155 172
156 173
157### Step 2: `merchant` request payment (event) 174### Step 2: `merchant` request payment (event)
158 175
@@ -204,6 +221,28 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
204 "shipped": <Bool, true/false has been shipped>, 221 "shipped": <Bool, true/false has been shipped>,
205} 222}
206``` 223```
224## Customize Marketplace
225Create a customized user experience using the `naddr` from [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md#shareable-identifiers-with-extra-metadata). The use of `naddr` enables easy sharing of marketplace events while incorporating a rich set of metadata. This metadata can include relays, merchant profiles, and more. Subsequently, it allows merchants to be grouped into a market, empowering the market creator to configure the marketplace's user interface and user experience, and share that marketplace. This customization can encompass elements such as market name, description, logo, banner, themes, and even color schemes, offering a tailored and unique marketplace experience.
226
227### Event `30019`: Create or update marketplace UI/UX
228
229**Event Content**:
230```json
231{
232 "name": <String (optional), market name>,
233 "about": <String (optional), market description>,
234 "ui": {
235 "picture": <String (optional), market logo image URL>,
236 "banner": <String (optional), market logo banner URL>,
237 "theme": <String (optional), market theme>,
238 "darkMode": <Bool, true/false>
239 },
240 "merchants": <[String] (optional), array of pubkeys>,
241 ...
242}
243```
244
245This event leverages naddr to enable comprehensive customization and sharing of marketplace configurations, fostering a unique and engaging marketplace environment.
207 246
208## Customer support events 247## Customer support events
209 248
@@ -211,4 +250,4 @@ Customer support is handled over whatever communication method was specified. If
211 250
212## Additional 251## Additional
213 252
214Standard data models can be found here <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a> 253Standard data models can be found <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a>