abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.94k stars 3.44k forks source link

Feature request: billable Add-ons #19526

Open torronen opened 7 months ago

torronen commented 7 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

I am trying to sell additional add-ons, such as extra user, additional storage, feature A,b,c, but currently I am limited in creating a set of predefined plans.

Describe the solution you'd like

I would like to see an option create "add-ons" in additions to plans. The add-ons would typically allow access to a specific module. I think the only difference is selling additional user licenses. Especially the number of user seats should be a common need I believe.

In some future version the "add-on" might override or increase the limit of settings in the plan. However, I think this could be considered separately.

Additional context

No response

maliming commented 7 months ago

hi

I think you can implement it by EditionFeature

https://docs.abp.io/en/abp/latest/Features https://docs.abp.io/en/commercial/latest/modules/saas#edition-management

torronen commented 7 months ago

Thx, I will re-read the docs carefully. However, as I understand it might not be possible. I might missunderstand something.

Example of I what I'd like to implement:

SELECT YOUR PLAN: Edition A: cloud storage, 1 gb, free, only web Edition B: cloud storeage, 1 gb, free, windows + mac app, $1 /month Edition c: cloud storeage, 10 gb, free, windows + mac app, $5/ month

SELECT ADD-ONS: [ ] Mobile support add +$1/month [ ] +5gb, +$1/month [ ] data encryption, +$1/month [ ] monthly backup, +$1/month [ ] weekly backup, +$5/month [ ] daily backup, +$10/month [ ] realtime virus scanner, +$1/month [1...99] additional user, +$1/month/user etc.

If I would use Edition I would need to make editions for all these combinations of base plan + different sets of add-ons. Is that correct? I think additionally, maybe, could be to dynamically create editions. For example Edition_Tenant123 that is based on based edition A + 3 additional users + data encryption. But, the problem I see is what if the base edition gets new features or old ones are removed?

I know many apps only have plans like: free,plus,pro,enterprise, but in my case I have lots of features that cost money to produce so the plans would be expensive if pro plan must include all of them. In the above example, ideally user could even take free base plan and add just monthly backups+encryption for a small amount some important files, but he does not need lots of storage of Edition C

maliming commented 7 months ago

hi

An Edition is a set of features. So you add an Edition and some features(ADD-ONS) to a tenant.

The framework will only check if the tenant has a feature.

Edition A: cloud storage, 1 gb, free, only web
Edition B: cloud storeage, 1 gb, free, windows + mac app, $1 /month
Edition c: cloud storeage, 10 gb, free, windows + mac app, $5/ month

SELECT ADD-ONS:
[ ] Mobile support add +$1/month
[ ] +5gb, +$1/month
[ ] data encryption, +$1/month
[ ] monthly backup, +$1/month
[ ] weekly backup, +$5/month
[ ] daily backup, +$10/month
[ ] realtime virus scanner, +$1/month
[1...99] additional user, +$1/month/user
torronen commented 7 months ago

Alright, got it. I will double-check this approach and close or add comment soon. Do you have hints on where to look to update the billing and price per addon? I just add directly to stripe?

maliming commented 7 months ago

hi

I'm not familiar with where to look to update the billing and price per addon.

But we do have a payment module.

https://docs.abp.io/en/commercial/latest/modules/payment

AhmadAlMunajjed commented 6 months ago

Hi @torronen,

Abp provides a dynamic features system supported by value providers. There are pre-defined providers default, edition and tenant, and you can define your own provider.

To achieve the use case you mentioned, you can implement it yourself by using edition and tenant providers and no need to define a new provider.

You need to use edition provider value for plan/edition and tenant value for add-on. Each add-on should have a feature name and value, to know how to set tenant feature value based on it.

My approach of implementing it:

  1. Create a plan
  2. Set plan features featureManager.SetForEditionAsync(editionId, featureName, featureValue)
  3. Once a user selects a plan, you need only to set claim value AbpClaimTypes.EditionId with selected plan/edition Id
  4. Once a user selects an add-on, set feature value for tenant like this featureManager.SetForTenantAsync(tenantId, featureName, featureValue)