peertube-plugin-sell-storage
v1.1.9
Published
Completely automated storage (video quota) subscriptions to users.
Maintainers
Readme
PeerTube Plugin Sell Storage
Table of Contents
About
This plugin allows you to sell storage space (video quota) to your users automatically with Stripe.
The most notable features are:
- Automatic video quota increases and decreases without human intervention.
- Dedicated page in the menu which promotes upgrading users' storage and makes it easy to see subscription information.
- Up to five different packages/subscriptions.
- The interface is unbranded, which makes this plugin accessible by every instance.
- Custom billing portal for customers to manage their subscriptions.
Prerequisites
- Stripe API key
- Stripe webhook (see the Configuration section)
- Stripe products (up to 5) for users to subscribe to
- Peertube >= v4.3.0
Installation
- Navigate to the "Settings" page on the PeerTube menu when logged in as an admin.
- Click on the "Plugins/Themes" section.
- Search for "sell-storage"
- Click "Install" near the plugin name
If you're installing locally
- Clone the Git repository, change directories, and build the plugin
git clone https://github.com/ayaadev/peertube-plugin-sell-storage.git
cd peertube-plugin-sell-storage
yarn
yarn build- Install via the PeerTube CLI.
Configuration
You need a Stripe account as stated in the Prerequisites section. Create an account on https://stripe.com to start.
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.
We recommend you to test the plugin in "Test mode" before going into "Live mode" (i.e. dealing with real money).
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.
API Keys
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.
Webhook configuration
Go to https://dashboard.stripe.com/webhooks and create a webhook with the following API events:
customer.subscription.createdcustomer.subscription.deletedcustomer.subscription.trial_will_endcustomer.subscription.updatedcheckout.session.completedinvoice.paidinvoice.payment_failedpayment_intent.succeeded
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.9 use the URL:
https://your-instance.tld/plugins/sell-storage/1.1.9/router/webhook
An example of this with the correct version in the webhook URL is available in the plugin settings.
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.9 change the webhook URL to https://your-instance.tld/plugins/sell-storage/1.1.9/router/webhook. Don't forget this!
PeerTube Plugin
Configure the following settings:
- Billing portal URL (enabled and customised at https://dashboard.stripe.com/settings/billing/portal)
- Currency
- Page description, thank you page description and cancel page description.
Plan configuration
It's time to add your plans!
- In stripe, go to https://dashboard.stripe.com/products and add a new product. Set a name, description and price. After creation, click on the product and click on the binocular icon at the bottom right.
- On the left side of the inspection window, click on the price key.
- On the right side of the inspection window, copy the price ID into the respective plan in the plugin settings.
Repeat steps 1-3 for each plan (1, 2, 3, 4, 5) in the plugin settings.
Usage
Navigate to "Storage Plan" underneath "My video space" in the PeerTube menu
Acknowledgements
This was inspired by and modified from peertube-plugin-ncd-sell-storage. Modifications include:
- 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.
- Branding removed. ncd-sell-storage had hardcoded branding which was removed so this plugin is accessible by everyone.
- Custom billing portal for customers to manage their subscriptions.
- Imrpoved documentation. For example, the necessary API events for the Stripe webhook are documented and screenshots have been included.
