This commit is contained in:
Acea Spades 2024-12-10 19:35:31 -08:00 committed by GitHub
commit 51c60dfffd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

77
15.md
View File

@ -1,5 +1,5 @@
NIP-15
====== ======
NIP-15
Nostr Marketplace Nostr Marketplace
----------------- -----------------
@ -10,6 +10,27 @@ Based on [Diagon-Alley](https://github.com/lnbits/Diagon-Alley).
Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market). Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market).
## Kinds
The following kinds are utilized by this NIP:
| Kind | | Description |
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `0` | `set_meta` | The merchant description (similar with any `nostr` public key). |
| `5` | `delete` | Delete a product or a stall. |
| `14` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `1021` | `bid` | Customer places bid on auctioned product. |
| `1022` | `bid_success` | Merchant accepts customer's bid for auctioned product. |
| `30017` | `set_stall` | Create or update a stall. |
| `30018` | `set_product` | Create or update a product. |
| `30018` | `customize_market` | Save customizations for marketplace experience. |
| `30020` | `set_auction` | Create or update a product sold as an auction |
| `30030` | `submit_order` | Customer submits order to merchant for product. |
| `30031` | `request_payment` | Merchant requests payment for order from customer. |
| `30032` | `confirm_payment` | Merchant confirms payment is received for order. |
| `30033` | `confirm_shipment` | Merchant confirms order has been shipped. |
## Terms ## Terms
- `merchant` - seller of products with NOSTR key-pair - `merchant` - seller of products with NOSTR key-pair
@ -20,6 +41,16 @@ Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeia
## Nostr Marketplace Clients ## Nostr Marketplace Clients
### Customer Events
A customer can publish these events:
| Kind | | Description |
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `14` | `direct_message` | Communicate with the merchant. The messages can be plain-text or JSON. |
| `1021` | `bid` | Customer places bid on auctioned product. |
| `30018` | `customize_market` | Save customizations for marketplace experience. |
| `30030` | `submit_order` | Customer submits order to merchant for product. |
### Merchant admin ### Merchant admin
Where the `merchant` creates, updates and deletes `stalls` and `products`, as well as where they manage sales, payments and communication with `customers`. Where the `merchant` creates, updates and deletes `stalls` and `products`, as well as where they manage sales, payments and communication with `customers`.
@ -36,10 +67,15 @@ A merchant can publish these events:
| Kind | | Description | | Kind | | Description |
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- | | --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `0` | `set_meta` | The merchant description (similar with any `nostr` public key). | | `0` | `set_meta` | The merchant description (similar with any `nostr` public key). |
| `5` | `delete` | Delete a product or a stall. |
| `14` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `1022` | `bid_success` | Merchant accepts customer's bid for auctioned product. |
| `30017` | `set_stall` | Create or update a stall. | | `30017` | `set_stall` | Create or update a stall. |
| `30018` | `set_product` | Create or update a product. | | `30018` | `set_product` | Create or update a product. |
| `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | | `30020` | `set_auction` | Create or update a product sold as an auction |
| `5` | `delete` | Delete a product or a stall. | | `30031` | `request_payment` | Merchant requests payment for order from customer. |
| `30032` | `confirm_payment` | Merchant confirms payment is received for order. |
| `30033` | `confirm_shipment` | Merchant confirms order has been shipped. |
### Event `30017`: Create or update a stall. ### Event `30017`: Create or update a stall.
@ -139,7 +175,7 @@ Fields that are not self-explanatory:
## Checkout events ## Checkout events
All checkout events are sent as JSON strings using [NIP-04](04.md). All checkout events are signed then sent as [NIP-17](17.md) Private Direct Messages between `customer` and `merchant`. Every checkout event contains the event's details as JSON in the `content` field.
The `merchant` and the `customer` can exchange JSON messages that represent different actions. Each `JSON` message `MUST` have a `type` field indicating the what the JSON represents. Possible types: The `merchant` and the `customer` can exchange JSON messages that represent different actions. Each `JSON` message `MUST` have a `type` field indicating the what the JSON represents. Possible types:
@ -149,8 +185,9 @@ The `merchant` and the `customer` can exchange JSON messages that represent diff
| 1 | Merchant | Payment Request | | 1 | Merchant | Payment Request |
| 2 | Merchant | Order Status Update | | 2 | Merchant | Order Status Update |
### Step 1: `customer` order (event) ### Event `30030` - Step 1: `customer` order
The below JSON goes in content of [NIP-04](04.md).
The below JSON goes in `content` of a kind: `30030` event. The event is signed, then sent to `merchant` in a [NIP-17](17.md) Private Direct Message.
```json ```json
{ {
@ -178,11 +215,11 @@ The below JSON goes in content of [NIP-04](04.md).
_Open_: is `contact.nostr` required? _Open_: is `contact.nostr` required?
### Step 2: `merchant` request payment (event) ### Event `30031` - Step 2: `merchant` request payment
Sent back from the merchant for payment. Any payment option is valid that the merchant can check. Sent from the `merchant` to the `customer` for payment. Any payment option is valid that the merchant can check.
The below JSON goes in `content` of [NIP-04](04.md). The below JSON goes in `content` of a kind: `30031` event. The event is signed, then sent to the `customer` in a [NIP-17](17.md) Private Direct Message.
`payment_options`/`type` include: `payment_options`/`type` include:
@ -213,11 +250,27 @@ The below JSON goes in `content` of [NIP-04](04.md).
} }
``` ```
### Step 3: `merchant` verify payment/shipped (event) ### Event `30032` - Step 3: `merchant` confirms payment is accepted
Once payment has been received and processed. Once payment has been received and processed.
The below JSON goes in `content` of [NIP-04](04.md). The below JSON goes in `content` of a kind: `30032` event. The event is signed, then sent to the `customer` in a [NIP-17](17.md) Private Direct Message.
```json
{
"id": <string, id of the order>,
"type": 2,
"message": <string, message to customer>,
"paid": <bool: has received payment>,
"shipped": <bool: has been shipped>,
}
```
### Event `30033` - Step 4: `merchant` confirms order has shipped
Once order has been shipped.
The below JSON goes in `content` of a kind: `30033` event. The event is signed, then sent to the `customer` in a [NIP-17](17.md) Private Direct Message.
```json ```json
{ {
@ -332,7 +385,7 @@ Another thing that can happen is - if bids happen very close to the end date of
## Customer support events ## Customer support events
Customer support is handled over whatever communication method was specified. If communicating via nostr, [NIP-04](04.md) is used. Customer support is handled over whatever communication method was specified. If communicating via nostr, [NIP-17](17.md) is used.
## Additional ## Additional