Add-ons
Add-ons let you sell optional modules on top of your app, such as “Pro features” or an extra plugin. Users unlock an add-on with a license, and each add-on has its own expiry, separate from the user’s main membership.
Main Membership vs Add-on Memberships
Every user has one main membership. On top of that, a user can have one add-on membership per add-on.
- The main membership alone decides whether a user can log in and counts as active
- Add-on memberships only tell your app which extra features to unlock
- Each add-on membership can be time-based or lifetime, just like the main membership
- An add-on membership can outlive the main membership, but the user still needs an active main membership to log in
Creating an Add-on
- Go to Add-ons in your dashboard
- Click Add add-on
- Enter a Name (shown to your app as the display name) and a Key
The key is what your app checks for. It can contain lowercase letters, numbers, hyphens (-) and underscores (_), up to 64 characters, and must be unique within your application.
Changing an add-on’s key later breaks app versions that still check for the old key.
Selling an Add-on
Create licenses that grant the add-on instead of the main membership:
- Create a license, or generate licenses in bulk
- In the Grants card, pick the add-on instead of Main membership
- Set the duration as usual
When a user activates the license, the duration is added to their membership for that add-on. The first activation creates the add-on membership.
Limitations:
- Credentials licenses always grant the main membership and can’t grant an add-on
- Users who log in with a license code can’t activate add-on licenses themselves. Activate the license for them from the license details page, or use the Admin API
Checking Add-ons in Your App
The current user’s add-ons are returned in Get App Context under user.add_ons. Look up the add-on by its key and check is_active:
authgate::AppContext context = client.get_app_context();
bool has_pro = false;
for (const auto& add_on : context.user->add_ons) {
if (add_on.key == "pro-features" && add_on.is_active) {
has_pro = true;
}
}The list contains every add-on the user has a membership for, including expired ones. A missing add-on means the user never had it.