From 7ad40d5159a806f2ae97bdbb2fc2a8bbb6fa89a2 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez Date: Sun, 5 Nov 2023 13:14:43 +0200 Subject: [PATCH] Recurring Subscriptions --- 88.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 81 insertions(+) create mode 100644 88.md diff --git a/88.md b/88.md new file mode 100644 index 0000000..2bfe990 --- /dev/null +++ b/88.md @@ -0,0 +1,79 @@ +NIP-88 +====== + +Recurring Subscriptions +----------------------- + +`draft` `optional` `author:pablof7z` + +This NIP defines a way for a pubkey to create recurring subscription payments to another pubkey. + +## Tier Event +A pubkey can create "tiers". These tiers might provide certain benefits to the supporters who subscribe to these. + +```json +{ + "kind": 7002, + "content": "", + "tags": [ + [ "title", "..." ], + [ "amount", "", "currency", "" ] + ] +} +``` + +This event is generated by a pubkey who wants to allow users to support with different tiers. + +`.content` SHOULD be a description of what users who subscribe can expect. +Tag `title` is an optional title for the tier. +Tag `amount` MUST specify the payment required for this tier and its cadence. + * The first argument should be the stringified amount and the second argument the currency + * The third argument SHOULD be one of `daily`, `monthly`, `yearly` +One or more `amount` tags MUST exist. + +#### Examples +* `[ "amount", "100", "usd", "daily" ]`, $1.00 a day. +* `[ "amount", "1000000", "btc", "daily" ]`, 1000000 millisats a day. + +## Subscribe Event + +```json +{ + "kind": 7001, + "content": "", + "tags": [ + [ "p", "" ], + [ "e", "" ], + [ "amount", "", "currency", "" ] + ] +} +``` + +When a user wants to subscribe to subscribe to support a user they create a `kind:7001` event. + +* `.content` is an optional message the supporter can write. +* The `p` tag MUST tag the pubkey being supported. +* The `e` tag is optional, and should point to a `kind:7001` support tier event. There MUST be exactly 0 or 1 `e` tags. +* The `amount` tag specifies what the supporters is committing to pay to the supported pubkey and the candence. + +The `kind:7001` event can be created without an `e` tag so that users can create recurring support events without the pubkey receiving the support having explicitly created a support tier. + +## Paying +The supporting user should create a zap p-tagging the receiver and e-tagging the `kind:7001`. There MUST be a single `p` and a single `e` tag in the zap request. + +```json +{ + "kind": 9734, + "content": "", + "tags": [ + [ "p", "" ], + [ "e", "" ] + ] +``` + +Clients supporting this NIP can check for zaps e-tagging the `kind:7001` event to find the pubkeys that have a valid, paid subscriptions at each different period. + +The same `kind:7001` is re-zapped on a regular basis per the cadence specified in the event. + +## Stopping a subscription +A user who wants to stop a subscription by publishing a `kind:5` deletion request of the `kind:7001` event. diff --git a/README.md b/README.md index 8be0595..feb26b6 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | `1985` | Label | [32](32.md) | | `4550` | Community Post Approval | [72](72.md) | | `7000` | Job Feedback | [90](90.md) | +| `7001` | Recurring Subscription | [88](88.md) | +| `7002` | Recurring Subscription Tier| [88](88.md) | | `9041` | Zap Goal | [75](75.md) | | `9734` | Zap Request | [57](57.md) | | `9735` | Zap | [57](57.md) |