Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@motorina0
Copy link
Collaborator

@motorina0 motorina0 commented Feb 1, 2024

Summary

Add support for paid extensions.
It is now possible for extension developers to require payment for their extension.
When an admin user wants to install an extension, it will be prompted with a request for payment. The payment can be made:

  • from one of the user's LNbits wallets, or
  • from an external wallet
install_paid_extension.mov

Features:

  • paid releases are required to have a pay_link field, see description here.
    • multiple releases can have the same pay_link (no need to pay again for a new release install)
    • but it is possible that some releases (eg. major upgrade) have their own pay_link, thus requiring a new payment to install them
  • if an extension is un-installed then the payment history is lost

Serve the extension file:

  • install paywall extension version 0.3.0 or higher. Check this video for creating a paywall for the extension zip file
  • or use this extensions.json test file in your server configuration
    • https://raw.githubusercontent.com/lnbits/lnbits-extensions/paid_extensions/extensions.json
    • the first 3 releases have a cost of 2 sats (basic features), the next 3 have a cost of 5 sats (premium)

Test Scenarios
Prerequisites: configure the repo for the paid extension (see above description).

  • install the extension by paying with a LNbits wallet
    • test also a wallet with no funds (should fail)
  • install the extension by displaying the QR code and paying with an external wallet
  • install the extension by displaying the QR code
    • after the QR code is displayed copy the invoice, but do not pay
    • refresh the page
    • pay the invoice
    • go back to the install dialog, and click Retry Install
  • uninstall the extension -> the payment history will be lost

@codecov
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: 85 lines in your changes are missing coverage. Please review.

Comparison is base (54c6faa) 59.17% compared to head (18869b8) 58.81%.

Files Patch % Lines
lnbits/extension_manager.py 33.33% 52 Missing ⚠️
lnbits/core/views/api.py 6.06% 31 Missing ⚠️
lnbits/app.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2229      +/-   ##
==========================================
- Coverage   59.17%   58.81%   -0.36%     
==========================================
  Files          60       60              
  Lines        9036     9133      +97     
==========================================
+ Hits         5347     5372      +25     
- Misses       3689     3761      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@prusnak

This comment was marked as resolved.

@motorina0

This comment was marked as duplicate.

@prusnak

This comment was marked as duplicate.

@motorina0 motorina0 requested review from arcbtc, dni and prusnak February 8, 2024 12:58
@motorina0 motorina0 marked this pull request as ready for review February 8, 2024 12:58
@motorina0

This comment was marked as resolved.

@dni dni modified the milestones: 0.12.2, 0.12.3 Feb 15, 2024
@arbadacarbaYK
Copy link
Contributor

Great idea ! If the payment is dependant on the version as in the video that means that hotfixes for it are also behind a paywall ?

@arcbtc
Copy link
Member

arcbtc commented Feb 22, 2024

interesting issue. I think its possible that once paid, you get access to all future updates.

@prusnak
Copy link
Collaborator

prusnak commented Feb 22, 2024

If the extension does not contain pay_link and the user has already paid for the previous version then this update is for free.

So let's say extension 1.0 and extension 2.0 have pay_links and versions 1.1, 1.2, 2.1 and 2.2 don't. In that case you need to pay only for the major version update, but not for minor version updates.

At least that is how I understand this feature is implemented.

@arcbtc arcbtc closed this Feb 22, 2024
@arcbtc arcbtc reopened this Feb 22, 2024
@motorina0
Copy link
Collaborator Author

@arbadacarbaYK @prusnak regarding the pay_link:

  • paid releases are required to have a pay_link field, see description here.

    • multiple releases can have the same pay_link (no need to pay again for a new release install)
    • but it is possible that some releases (eg. major upgrade) have their own pay_link, thus requiring a new payment to install them
  • if an extension is un-installed then the payment history is lost

  • if no pay_link field, then it is free to install

Those this ☝️ answer your concerns?

@motorina0
Copy link
Collaborator Author

If the extension does not contain pay_link and the user has already paid for the previous version then this update is for free.

  • no pay_link means it is free
  • multiple releases can have the same pay_link, a diferent zip file is downloaded based on the version value (see paywall ext readme also)
  • the user pays only once for a pay_link

So let's say extension 1.0 and extension 2.0 have pay_links and versions 1.1, 1.2, 2.1 and 2.2 don't. In that case you need to pay only for the major version update, but not for minor version updates.

At least that is how I understand this feature is implemented.

  • the releases 1.1, 1.2 must have the same pay_link as 1.0, user only pays once and can install any of the 3 version
  • the releases 2.1, 2.2 must have the same pay_link as 2.0

@arcbtc arcbtc merged commit d6c8ad1 into dev Feb 22, 2024
@arcbtc arcbtc deleted the paid_extensions branch February 22, 2024 13:16
@prusnak
Copy link
Collaborator

prusnak commented Feb 22, 2024

@motorina0 ah yes. That is even better. Love this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants