diff options
| author | ktecho <ktecho@ktecho.com> | 2023-08-10 00:16:35 +0200 |
|---|---|---|
| committer | ktecho <ktecho@ktecho.com> | 2023-08-10 00:16:35 +0200 |
| commit | e5a6c2c698bcfca4d9d135343fabf8846214314a (patch) | |
| tree | 294eeaf6b227251095d13051a357009d88c8beb0 /15.md | |
| parent | ce7e6b2100918648ec4341c5fe517d076e8d225c (diff) | |
Adding (optional) shipping costs per product to nip-15
Diffstat (limited to '15.md')
| -rw-r--r-- | 15.md | 32 |
1 files changed, 24 insertions, 8 deletions
| @@ -8,7 +8,7 @@ Nostr Marketplace (for resilient marketplaces) | |||
| 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 | ||
| @@ -54,7 +54,7 @@ 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 | "countries": [<String, countries included in this zone>], |
| 59 | } | 59 | } |
| 60 | ] | 60 | ] |
| @@ -63,9 +63,12 @@ A merchant can publish these events: | |||
| 63 | 63 | ||
| 64 | Fields that are not self-explanatory: | 64 | Fields 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 |
| @@ -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, base cost for shipping. The currency is defined at the stall level>, | ||
| 99 | } | ||
| 100 | ] | ||
| 92 | } | 101 | } |
| 93 | ``` | 102 | ``` |
| 94 | 103 | ||
| 95 | Fields that are not self-explanatory: | 104 | Fields 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 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 |
| @@ -211,4 +227,4 @@ Customer support is handled over whatever communication method was specified. If | |||
| 211 | 227 | ||
| 212 | ## Additional | 228 | ## Additional |
| 213 | 229 | ||
| 214 | Standard data models can be found here <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a> | 230 | Standard data models can be found <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a> |