Subscriptions¶
All Premium-related entities are stored in /subscriptions/<uid> location. These include
- Recurring subscriptions (Individual Premium)
- Group IAPs (Group Premium)
- Gifts (given by us to users for a given period)
- Rewards (users invited their friends to Settle Up and received a free feature)
User's susbcription¶
When presenting user's subscription state use the following approach
- Premium since - Take oldest subscription (
type == monthly|yearly|gift) bystart - Current status
- Take subscription (
type == monthly|yearly|gift) which expires last byend - If billing is active is specified by
active - If not
activeshow Renew button (but only if it's from your platform, specified bystore)
- Take subscription (
Group subscriptions¶
There are two types
- Lifetime
- These do NOT have
endand their sku ends with_9999 - Historical ones might have a different sku, but they still lack the
end
- These do NOT have
- Time-limited
- These DO have
endand their SKU ends with number of days they are valid for (7/14/31/366) - They also have a
durationDaysfield set
- These DO have
If the Premium group is closed (deleted or archived) the Group Premium becomes an Empty Slot by deleting their groupId. This doesn't affect their end: if the user doesn't assign it to a group they still expire. In such case their groupId is set to __EXPIRED_SUBSCRIPTION__ so that old apps don't see this as an available Empty Slot. New apps should check their end to see if it still can be activated.
Ordering Group Premium¶
When presenting Group Premiums (both assigned to a group and empty slots), here's the order:
- Assigned GPs go first, then empty slots
- First order by expiration (earliest first), lifetime last
- Then alphabetically by group name (irrelevant for empty slots)
Extending group subscriptions¶
Users can extend existing time-limited Group Premiums by again calling verifyGroupPremium server task, but with extendSubscriptionId. See server task for details.
Important: extending a Group Premium can be done only by the same user who bought the original one. Once it expires anyone can buy it again.
Premium groups¶
Premium groups are identified by their
premiumPurchasedBy- who bought the PremiumpremiumPurchasedUntil- if set tells when the Premium expired (lifetime if missing)
Backend will daily remove premiumPurchasedBy if premiumPurchasedUntil expired to make sure older app versions do not treat the group as premium. New versions should check premiumPurchasedUntil.
Rewards¶
Users can receive a reward in the form of a Premium feature. Currently whenever a user invites 5 new users (configurable in remote config) they will receive a Premium feature of their choice. Apps should unlock this feature and not require any Premium.
Offers¶
During special campaigns (such as Black Friday) we can unlock promotional offers - discounts for specific Premium items, e.g. IP yearly or GP for 2 weeks. This is configured in 2 steps:
- Create an offer entry in database.
- Use the new offer
keyto setup a discount in each store (App Store / Google Play / Stripe), see details here
When the apps pull prices for Premium SKUs they should discover this new key and pull given item from /offers/<offer_key>. Once the offer expires, they should treat as if it doesn't exist. This should be done realtime.
Colors¶
There are three types of colors (each with light and dark version).
- Primary - used for "dashes", icons and highlighted text elements (IP/GP color used if missing)
- Secondary - used for other text elements (black/white used if missing)
- Tertiary - used for background (use 15% Primary + 85% transparent if missing)
Overrides and A/B tests¶
To enable A/B testing different variants use premium_offer_overrides key in Remote config. It should be a JSON entry with top level key equal to offer key and the nested object should match the Optional<Offer> object structure - it should act as overrides to the base offer in database. These overrides can then be A/B tested.
Show Premium prompt¶
When a user wants to use a Premium feature these are all the checks needed:
- has Individual Premium or Gift?
- has Group Premium in the group where the Premium feature was clicked?
- has User reward for this specific feature?
If all are false show a Premium prompt (bottom sheet).