peertube-plugin-sell-storage 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -38
- package/main.js +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,77 +3,124 @@
|
|
|
3
3
|
## Table of Contents
|
|
4
4
|
|
|
5
5
|
- [About](#about)
|
|
6
|
-
- [
|
|
6
|
+
- [Prerequisites](#prerequisites)
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Configuration](#configuration)
|
|
7
9
|
- [Usage](#usage)
|
|
10
|
+
- [Acknowledgements](#acknowledgements)
|
|
8
11
|
|
|
9
12
|
## About <a name = "about"></a>
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
This plugin allows you to sell storage space to your users using Stripe subscription. Payments are automated with Stripe.
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
The most notable features are:
|
|
18
|
+
- Automatic video quota increases and decreases without human intervention.
|
|
19
|
+
- Dedicated page in the menu which promotes upgrading users' storage and makes it easy to see subscription information.
|
|
20
|
+
- Up to five different packages/subscriptions.
|
|
21
|
+
- The interface is unbranded, which makes this plugin accessible by every instance.
|
|
22
|
+
- Custom billing portal for customers to manage their subscriptions.
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
## Prerequisites <a name="prerequisites"></a>
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
- Stripe API key
|
|
27
|
+
- Stripe webhook (see the [Configuration](#configuration) section)
|
|
28
|
+
- Stripe products (up to 5) for users to subscribe to
|
|
29
|
+
- Peertube >= v4.3.0
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
## Installation <a name="installation"></a>
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
- Navigate to the "Settings" page on the PeerTube menu when logged in as an admin.
|
|
34
|
+
- Click on the "Plugins/Themes" section.
|
|
35
|
+
- Search for "sell-storage"
|
|
36
|
+
- Click "Install" near the plugin name
|
|
37
|
+
|
|
38
|
+
### If you're installing locally
|
|
39
|
+
- Clone the Git repository, change directories, and build the plugin
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/ayaadev/peertube-plugin-sell-storage.git
|
|
42
|
+
cd peertube-plugin-sell-storage
|
|
43
|
+
yarn
|
|
44
|
+
yarn build
|
|
45
|
+
```
|
|
46
|
+
- Install via the [PeerTube CLI](https://docs.joinpeertube.org/contribute/plugins#test-your-plugin-theme).
|
|
47
|
+
|
|
48
|
+
## Configuration <a name="configuration"></a>
|
|
49
|
+
You need a Stripe account as stated in the [Prerequisites](#prerequisites) section.
|
|
50
|
+
Create an account on https://stripe.com to start.
|
|
25
51
|
|
|
26
|
-
- Peertube >= v4.3.0
|
|
27
52
|
|
|
28
|
-
|
|
53
|
+
Once you've validated your email and inputted your business details, you can test in "Test mode", and go live by unchecking "Test mode". This option is found by hovering over your business name in the top left.
|
|
54
|
+
<img width="712" height="433" alt="image" src="https://github.com/user-attachments/assets/f9ee2825-45ab-4ae4-8402-2c26acba01b5" />
|
|
29
55
|
|
|
30
|
-
|
|
31
|
-
- Navigate to the "Plugins" page
|
|
32
|
-
- Search for "sell-storage"
|
|
33
|
-
- Click Install near the plugin name
|
|
56
|
+
We recommend you to test the plugin in "Test mode" before going into "Live mode" (i.e. dealing with real money).
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
- Clone Git repository
|
|
37
|
-
- cd peertube-plugin-sell-storage
|
|
38
|
-
- yarn
|
|
39
|
-
- yarn build
|
|
40
|
-
- Install via PeerTube CLI
|
|
58
|
+
**Note: If you perform a transaction in Test Mode, you'll need to manually clear the subscription status because the webhook will not send back the correct validation response, meaning the changes will take effect but nothing will be charged. Use a dedicated test account.**
|
|
41
59
|
|
|
42
|
-
###
|
|
43
|
-
You need to configuration the plugin to work.
|
|
44
|
-
Create an account on https://stripe.com to start.
|
|
60
|
+
### API Keys
|
|
45
61
|
|
|
62
|
+
You need the Secret API Key to add to the plugin configuration. Navigate to https://dashboard.stripe.com/apikeys. Copy and paste the Secret API Key into the plugin settings.
|
|
46
63
|
|
|
47
|
-
|
|
48
|
-
To go in live mode, you need to fill form in Stripe side. We recommand you to test in Test mode the integration before go in live.
|
|
64
|
+
<img width="1524" height="327" alt="image" src="https://github.com/user-attachments/assets/250e4f8e-3652-4582-b710-6d57882b3fa2" />
|
|
49
65
|
|
|
50
|
-
### Note: If you perform a transaction in Test Mode, you'll need to manually clear the subscription status because the webhook will not send back the correct validation response, meaning the changes will take effect but nothing will be charged. Use a dedicated test account.
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
### Webhook configuration
|
|
53
68
|
|
|
54
|
-
|
|
55
|
-
- `checkout.session.completed`
|
|
69
|
+
Go to https://dashboard.stripe.com/webhooks and create a webhook with the following API events:
|
|
56
70
|
- `customer.subscription.created`
|
|
57
71
|
- `customer.subscription.deleted`
|
|
58
72
|
- `customer.subscription.trial_will_end`
|
|
59
73
|
- `customer.subscription.updated`
|
|
74
|
+
- `checkout.session.completed`
|
|
60
75
|
- `invoice.paid`
|
|
61
76
|
- `invoice.payment_failed`
|
|
62
77
|
- `payment_intent.succeeded`
|
|
63
78
|
|
|
64
|
-
|
|
65
|
-
https://your-instance.tld/plugins/sell-storage/1.1.
|
|
79
|
+
For the webhook URL, make sure the version in the URL matches the version of the plugin. For example, if your plugin is on version `1.1.7` use the URL:
|
|
80
|
+
`https://your-instance.tld/plugins/sell-storage/1.1.7/router/webhook`
|
|
81
|
+
|
|
82
|
+
An example of this with the correct version in the webhook URL is available in the plugin settings.
|
|
66
83
|
|
|
67
|
-
|
|
84
|
+
**Note: If you update the plugin, you'll have to update the webhook link in Stripe with the new version. For example, if you update from 1.1.3 to 1.1.7 change the webhook URL to `https://your-instance.tld/plugins/sell-storage/1.1.7/router/webhook`. Don't forget this!**
|
|
68
85
|
|
|
69
|
-
|
|
86
|
+
### PeerTube Plugin
|
|
70
87
|
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
Configure the following settings:
|
|
89
|
+
- Billing portal URL (enabled and customised at https://dashboard.stripe.com/settings/billing/portal)
|
|
90
|
+
- Currency
|
|
91
|
+
- Page description, thank you page description and cancel page description.
|
|
73
92
|
|
|
74
|
-
|
|
75
|
-
|
|
93
|
+
### Plan configuration
|
|
94
|
+
It's time to add your plans!
|
|
95
|
+
|
|
96
|
+
1. In stripe, go to https://dashboard.stripe.com/products and add a new product. Set a name, description and price.
|
|
97
|
+
After creation, click on the product and click on the binocular icon at the bottom right.
|
|
98
|
+
<img width="405" height="62" alt="image" src="https://github.com/user-attachments/assets/8b5f95f8-e20a-4cb2-b9e4-872c48ae86e5" />
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
2. On the left side of the inspection window, click on the price key.
|
|
103
|
+
<img width="395" height="300" alt="image" src="https://github.com/user-attachments/assets/c20b5320-f88c-4c4f-820b-f9188b84efde" />
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
3. On the right side of the inspection window, copy the price ID into the respective plan in the plugin settings.
|
|
108
|
+
<img width="436" height="319" alt="image" src="https://github.com/user-attachments/assets/017ced89-6ab5-4b53-8565-93bf1ec0c5f5" />
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
Repeat steps 1-3 for each plan (1, 2, 3, 4, 5) in the plugin settings.
|
|
76
113
|
|
|
77
114
|
## Usage <a name = "usage"></a>
|
|
78
115
|
|
|
79
|
-
|
|
116
|
+
Navigate to "Storage Plan" underneath "My video space" in the PeerTube menu
|
|
117
|
+
|
|
118
|
+
<img width="212" height="258" alt="image" src="https://github.com/user-attachments/assets/05d4b7a2-0964-4bf2-9981-251f32b162b3" />
|
|
119
|
+
|
|
120
|
+
## Acknowledgements <a name = "acknowledgements"></a>
|
|
121
|
+
|
|
122
|
+
This was inspired by and modified from [peertube-plugin-ncd-sell-storage](https://gitea.nicecrew.digital/matty/peertube-plugin-ncd-sell-storage). Modifications include:
|
|
123
|
+
- Error free! **At the time of writing this**, the published version of ncd-sell-storage is outdated and therefore does not work despite the fix being available on their Git repository.
|
|
124
|
+
- Branding removed. ncd-sell-storage had hardcoded branding which was removed so this plugin is accessible by everyone.
|
|
125
|
+
- Custom billing portal for customers to manage their subscriptions.
|
|
126
|
+
- Imrpoved documentation. For example, the necessary API events for the Stripe webhook are documented and screenshots have been included.
|
package/main.js
CHANGED
|
@@ -400,7 +400,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
400
400
|
type: "markdown-enhanced",
|
|
401
401
|
private: false,
|
|
402
402
|
descriptionHTML: "You can explain what you want, it is showed on the page. Leave it empty to show default localized description.",
|
|
403
|
-
default: "
|
|
403
|
+
default: "If you need more storage space, please contact us using the contact form."
|
|
404
404
|
});
|
|
405
405
|
|
|
406
406
|
registerSetting({
|
|
@@ -409,7 +409,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
409
409
|
type: "markdown-enhanced",
|
|
410
410
|
private: false,
|
|
411
411
|
descriptionHTML: "If you want to show a text on the Success page after payment",
|
|
412
|
-
default: ""
|
|
412
|
+
default: "Thanks for your support!"
|
|
413
413
|
});
|
|
414
414
|
|
|
415
415
|
registerSetting({
|
|
@@ -418,7 +418,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
418
418
|
type: "markdown-enhanced",
|
|
419
419
|
private: false,
|
|
420
420
|
descriptionHTML: "If you want to show a text on the Cancel page after payment canceled",
|
|
421
|
-
default: ""
|
|
421
|
+
default: "Have a great rest of your day!"
|
|
422
422
|
});
|
|
423
423
|
|
|
424
424
|
|
|
@@ -440,7 +440,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
440
440
|
type: "input",
|
|
441
441
|
private: false,
|
|
442
442
|
descriptionHTML: "Specify the name of your plan",
|
|
443
|
-
default: "Starter
|
|
443
|
+
default: "Starter Plan",
|
|
444
444
|
});
|
|
445
445
|
|
|
446
446
|
registerSetting({
|
|
@@ -457,7 +457,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
457
457
|
label: "Plan price /month",
|
|
458
458
|
type: "input",
|
|
459
459
|
private: false,
|
|
460
|
-
descriptionHTML: "Specify the price
|
|
460
|
+
descriptionHTML: "Specify the price per month users pay for this plan",
|
|
461
461
|
default: 5,
|
|
462
462
|
});
|
|
463
463
|
|
|
@@ -482,7 +482,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
482
482
|
type: "input",
|
|
483
483
|
private: false,
|
|
484
484
|
descriptionHTML: "Specify the name of your plan",
|
|
485
|
-
default: "Community
|
|
485
|
+
default: "Community Plan",
|
|
486
486
|
});
|
|
487
487
|
|
|
488
488
|
registerSetting({
|
|
@@ -499,7 +499,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
499
499
|
label: "Plan price /month",
|
|
500
500
|
type: "input",
|
|
501
501
|
private: false,
|
|
502
|
-
descriptionHTML: "Specify the price
|
|
502
|
+
descriptionHTML: "Specify the price per month users pay for this plan",
|
|
503
503
|
default: 10,
|
|
504
504
|
});
|
|
505
505
|
|
|
@@ -523,7 +523,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
523
523
|
type: "input",
|
|
524
524
|
private: false,
|
|
525
525
|
descriptionHTML: "Specify the name of your plan",
|
|
526
|
-
default: "
|
|
526
|
+
default: "Professional Plan",
|
|
527
527
|
});
|
|
528
528
|
|
|
529
529
|
registerSetting({
|
|
@@ -540,7 +540,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
540
540
|
label: "Plan price /month",
|
|
541
541
|
type: "input",
|
|
542
542
|
private: false,
|
|
543
|
-
descriptionHTML: "Specify the price
|
|
543
|
+
descriptionHTML: "Specify the price per month users pay for this plan",
|
|
544
544
|
default: 15,
|
|
545
545
|
});
|
|
546
546
|
|
|
@@ -564,7 +564,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
564
564
|
type: "input",
|
|
565
565
|
private: false,
|
|
566
566
|
descriptionHTML: "Specify the name of your plan",
|
|
567
|
-
default: "
|
|
567
|
+
default: "Professional Plan",
|
|
568
568
|
});
|
|
569
569
|
|
|
570
570
|
registerSetting({
|
|
@@ -581,7 +581,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
581
581
|
label: "Plan price /month",
|
|
582
582
|
type: "input",
|
|
583
583
|
private: false,
|
|
584
|
-
descriptionHTML: "Specify the price
|
|
584
|
+
descriptionHTML: "Specify the price per month users pay for this plan",
|
|
585
585
|
default: 15,
|
|
586
586
|
});
|
|
587
587
|
|
|
@@ -605,7 +605,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
605
605
|
type: "input",
|
|
606
606
|
private: false,
|
|
607
607
|
descriptionHTML: "Specify the name of your plan",
|
|
608
|
-
default: "
|
|
608
|
+
default: "Professional Plan",
|
|
609
609
|
});
|
|
610
610
|
|
|
611
611
|
registerSetting({
|
|
@@ -622,7 +622,7 @@ function registerMenuSettings(registerSetting) {
|
|
|
622
622
|
label: "Plan price /month",
|
|
623
623
|
type: "input",
|
|
624
624
|
private: false,
|
|
625
|
-
descriptionHTML: "Specify the price
|
|
625
|
+
descriptionHTML: "Specify the price per month users pay for this plan",
|
|
626
626
|
default: 15,
|
|
627
627
|
});
|
|
628
628
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peertube-plugin-sell-storage",
|
|
3
3
|
"description": "Updated and republished version of peertube-plugin-ncd-sell-storage to sell storage to users using Stripe",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.7",
|
|
5
5
|
"author": "AyaaDev",
|
|
6
6
|
"bugs": "https://github.com/ayaadev/peertube-plugin-sell-storage",
|
|
7
7
|
"clientScripts": [
|