Subscription implementation history 2
This is the historical implementation checklist, not a statement of current feature availability. For registered events and capabilities use the generated reference.
- Handle feature flags / subscription events
- Every time a subscription is activated/deactivated
- set
active_featureson the right entity (based on the metadata of the subscription) - set
active_planson the right entity (based on the metadata of the subscription)
- set
- When the features of a plan changed, update
active_featuresfor all entities that have that plan active- We sync! I.e. if a feature was added, give it to everyone that has that plan, if a feature was removed, remove it from everyone that has that plan.
- Handle removing plans form the config
- Keep the plan identifier in
active_plans, but remove the features since we don’t know them anymore. - We do not delete plan (products) or prices in stripe
- Keep the plan identifier in
- Handle manually activated plans
- If a defined plan has no prices, don’t return it when fetching available plans
- update
active_featureswhen manually changingactive_plans - Make sure that when rebuilding the
active_plansfield on a subscription change, only add / remove the plan that this subscription was for. Leave the others untouched.- I.e. when I have
plan_a, plan_band I buyplan_c, the new value ofactive_plansshould beplan_a, plan_b, plan_c - Now I manually add
plan_dto theactive_plansfield, the new value should beplan_a, plan_b, plan_c, plan_d - When
plan_ais deactivated, the new value should beplan_b, plan_c, plan_d, even thoughplan_dwas not bought via a subscription.
- I.e. when I have
- Every time a subscription is activated/deactivated
- Build migration
Maybe migrate over old data fromentity_subscriptiontable to the new way of storing / registering subscriptions- Remove old tables and columns
- license stuff
license_plan_moduletablelicense_planstablelicensestable- All fields, need to find them
- old subscription stuff
module_subscriptiontablemodule_subscription_pricestableentity_subscriptiontable- All fields, need to find them
- license stuff
- Dump old tables and data
- Build some default SPA handling for all of this
- Widget / Modal for each entity from a Buyable module that
- Shows the active plans and features
- Allows to buy a plan
- Allows to manage the subscription (redirect to stripe customer portal)
- Api class helper functions to
- Get all buyable plans for a module
- initiate a subscription for a plan on an entity with a specified price
- get all plans, not just the ones with prices
- Rebuild how translations are handled for the plans.
- Remove the
nameordescriptionfields of plans, features and prices. They should be translated via their identifier.- Translation paths are
modules.<module_identifier>.subscription_plans.<plan_identifier>.title,modules.<module_identifier>.subscription_plans.<plan_identifier>.descriptionmodules.<module_identifier>.subscription_plans.features.<feature_identifier>modules.<module_identifier>.subscription_plans.prices.<price_identifier>
- Translation paths are
- Remove the
- Widget / Modal for each entity from a Buyable module that
-
entity.hasActiveFeature(<slug>)- Api recipes
- SPA recipes