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:
authorPablo Fernandez <p@f7z.io>2023-10-15 21:30:42 +0300
committerGitHub <noreply@github.com>2023-10-15 21:30:42 +0300
commita482f47ae4c36d38062cd0fd3ee6235e57691673 (patch)
treea16f57208cd3c3ef74237dafcef277f16d70e688 /15.md
parentd9400e1e7b08225aedb6c78b522c5ad07b5198b4 (diff)
parent202e18f2b256646148805880ed58731c1c8b2b9b (diff)
Merge branch 'master' into vending-machine
Diffstat (limited to '15.md')
-rw-r--r--15.md80
1 files changed, 59 insertions, 21 deletions
diff --git a/15.md b/15.md
index f8df328..edece81 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
@@ -87,17 +90,30 @@ Fields that are not self-explanatory:
87 "price": <float, cost of product>, 90 "price": <float, cost of product>,
88 "quantity": <int, available items>, 91 "quantity": <int, 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:
96 - `specs`: 105 - `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 106 - 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"]]` 107 - eg: `[["operating_system", "Android 12.0"], ["screen_size", "6.4 inches"], ["connector_type", "USB Type C"]]`
99 108
100_Open_: better to move `spec` in the `tags` section of the event? 109 _Open_: better to move `spec` in the `tags` section of the event?
110
111- `shipping`:
112 - 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
113 - the `id` should match the id of the shipping zone, as defined in the `shipping` field of the stall
114 - 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:
115 - the `base cost from the stall` for the chosen shipping option
116 - the result of multiplying the product units by the `shipping costs specified in the product`, if any.
101 117
102**Event Tags**: 118**Event Tags**:
103```json 119```json
@@ -109,8 +125,8 @@ _Open_: better to move `spec` in the `tags` section of the event?
109 ] 125 ]
110``` 126```
111 127
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`. 128 - 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. 129 - 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 130
115## Checkout events 131## Checkout events
116 132
@@ -152,7 +168,7 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips
152``` 168```
153 169
154_Open_: is `contact.nostr` required? 170_Open_: is `contact.nostr` required?
155 171
156 172
157### Step 2: `merchant` request payment (event) 173### Step 2: `merchant` request payment (event)
158 174
@@ -204,6 +220,28 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
204 "shipped": <Bool, true/false has been shipped>, 220 "shipped": <Bool, true/false has been shipped>,
205} 221}
206``` 222```
223## Customize Marketplace
224Create 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.
225
226### Event `30019`: Create or update marketplace UI/UX
227
228**Event Content**:
229```json
230{
231 "name": <String (optional), market name>,
232 "about": <String (optional), market description>,
233 "ui": {
234 "picture": <String (optional), market logo image URL>,
235 "banner": <String (optional), market logo banner URL>,
236 "theme": <String (optional), market theme>,
237 "darkMode": <Bool, true/false>
238 },
239 "merchants": <[String] (optional), array of pubkeys>,
240 ...
241}
242```
243
244This event leverages naddr to enable comprehensive customization and sharing of marketplace configurations, fostering a unique and engaging marketplace environment.
207 245
208## Customer support events 246## Customer support events
209 247
@@ -211,4 +249,4 @@ Customer support is handled over whatever communication method was specified. If
211 249
212## Additional 250## Additional
213 251
214Standard data models can be found here <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a> 252Standard data models can be found <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a>