Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 65 additions & 12 deletions 15.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NIP-15
======
NIP-15

Nostr Marketplace
-----------------
Expand All @@ -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).

## 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

- `merchant` - seller of products with NOSTR key-pair
Expand All @@ -20,6 +41,16 @@ Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeia

## 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

Where the `merchant` creates, updates and deletes `stalls` and `products`, as well as where they manage sales, payments and communication with `customers`.
Expand All @@ -36,10 +67,15 @@ A merchant can publish these events:
| 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. |
| `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. |
| `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `5` | `delete` | Delete a product or a stall. |
| `30020` | `set_auction` | Create or update a product sold as an auction |
| `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.

Expand Down Expand Up @@ -139,7 +175,7 @@ Fields that are not self-explanatory:

## 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:

Expand All @@ -149,8 +185,9 @@ The `merchant` and the `customer` can exchange JSON messages that represent diff
| 1 | Merchant | Payment Request |
| 2 | Merchant | Order Status Update |

### Step 1: `customer` order (event)
The below JSON goes in content of [NIP-04](04.md).
### Event `30030` - Step 1: `customer` order

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
{
Expand Down Expand Up @@ -178,11 +215,11 @@ The below JSON goes in content of [NIP-04](04.md).
_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:

Expand Down Expand Up @@ -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.

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
{
Expand Down Expand Up @@ -331,7 +384,7 @@ Another thing that can happen is - if bids happen very close to the end date of

## 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

Expand Down