Skip to content

Add activation limit support for LemonSqueezy licenses - #42

Open
mojtaba-nasehzadeh wants to merge 2 commits into
Spare-Brained-Community:mainfrom
mojtaba-nasehzadeh:activation_limit
Open

Add activation limit support for LemonSqueezy licenses#42
mojtaba-nasehzadeh wants to merge 2 commits into
Spare-Brained-Community:mainfrom
mojtaba-nasehzadeh:activation_limit

Conversation

@mojtaba-nasehzadeh

@mojtaba-nasehzadeh mojtaba-nasehzadeh commented Sep 23, 2025

Copy link
Copy Markdown

Add Dynamic Activation Limit Support for LemonSqueezy Licenses
This PR adds support for extracting and utilizing the activation_limit field from LemonSqueezy
API responses, enabling applications to implement dynamic user limits instead of hardcoding values.

Problem Statement
Current State: Applications using the SpareBrained Licensing framework hardcode user limits
Issue: This approach is inflexible and requires code changes to adjust user limits per license.
Goal: Enable dynamic user limits based on LemonSqueezy license configuration.

  • Stores the value persistently in the Extension License table
  • Provides public GetActivationLimit() procedure for consuming applications
  • Includes comprehensive error handling for missing data
  • Maintains backward compatibility
  • Supports both platforms (LemonSqueezy with data, Gumroad returns 0)
  • Makes the field visible in the Extension Licenses UI
  • Uses proper AL namespace structure and coding standards

  - Stores the value persistently in the Extension License table
  - Provides public GetActivationLimit() procedure for consuming applications
  - Includes comprehensive error handling for missing data
  - Maintains backward compatibility
  - Supports both platforms (LemonSqueezy with data, Gumroad returns 0)
  - Makes the field visible in the Extension Licenses UI
  - Uses proper AL namespace structure and coding standards
@mojtaba-nasehzadeh mojtaba-nasehzadeh changed the title - Parses activation_limit from LemonSqueezy API responses activation_limit Sep 23, 2025
@mojtaba-nasehzadeh mojtaba-nasehzadeh changed the title activation_limit Add activation limit support for LemonSqueezy licenses Sep 23, 2025
@mojtaba-nasehzadeh

Copy link
Copy Markdown
Author

Hi @JeremyVyska, would you mind reviewing this PR?

@JeremyVyska

Copy link
Copy Markdown
Contributor

One of my great frustrations with Interfaces? You can't change them once on AppSource. Any change to them at all is treated as a breaking change, even if you're just adding a new function.

So, while I like this change, it'll fail when pushed to AppSource. We'd have to add a new "IActivationLimit" interface and add it to the system.

@JeremyVyska

Copy link
Copy Markdown
Contributor

@StefanMaron - see any issues? I think this makes sense and should pass validation now.

@StefanMaron StefanMaron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the activation limit really the limit? Or is it the remaining activations? Because if its the remaining activations, using 0 as unlimited will always allow unlimited activations


// Find the license record by license key
SPBExtensionLicense.SetRange("License Key", LicenseKey);
if not SPBExtensionLicense.FindFirst() then begin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove begin .. end, add SetloadFields and ReadIsolation

// If not stored locally, try to get from fresh API call
if CallAPIForActivation(SPBExtensionLicense, ResponseBody) then begin
PopulateSubscriptionFromResponse(SPBExtensionLicense, ResponseBody);
if SPBExtensionLicense.Modify() then begin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify(true)

// If not stored locally, try to get from fresh API call
if CallAPIForActivation(SPBExtensionLicense, ResponseBody) then begin
PopulateSubscriptionFromResponse(SPBExtensionLicense, ResponseBody);
if SPBExtensionLicense.Modify() then begin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove begin..end

Caption = 'Activation Limit';
DataClassification = SystemMetadata;
Editable = false;
ToolTip = 'The maximum number of activations allowed for this license. 0 indicates unlimited or information not available.';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to Specifies the maximum...

"name": "Spare Brained Licensing",
"publisher": "Stefan Maron Consulting",
"version": "25.7.0.0",
"version": "26.5.37194.39023",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dont change the version manually as the pipelines will do that automatically

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.

3 participants