Magento 2 extension license server: how vendors do it, your options, and a setup to copy
If you sell Magento 2 extensions, you need licensing: a way to issue keys, deliver code only to people who paid, and stop serving updates when the paid period ends. Below is how the known vendors do it, the options you can pick from for each part, and a universal setup that avoids their mistakes.
I am Oleksandr Osadchyi, an ex-Magento 2 core engineer and Adobe Certified Master, Adobe Commerce Architect, with 13 years on Magento stores. My commits are in the public magento/magento2 repository.
How vendors do it today
Findings from my research for a licensing specification: vendor code, documentation and EULAs.
| Vendor | How it works | What to learn from it |
|---|---|---|
| Amasty | A base module, amasty/base, ships inside every extension and talks to the license server. Composer-only delivery since January 2025. | The license call runs synchronously when the admin saves config, with a 60-second timeout. The license channel sets verifypeer => false. Only the default store hostname is sent. The result is cached unsigned, so one SQL UPDATE forges active. A long time without a check counts as an error, so a broken merchant cron produces a license error. |
| Mirasvit | License result cached in the store database. The key is part of the Composer repository URL. | The cache is unsigned, same forgery. The URL with the key ends up in the merchant's committed composer.json and is shared with every contractor. |
| Aheadworks | Subscriptions. Composer repository at dist.aheadworks.com, authenticated with account keys. Most modules have no license keys. The EULA allows automated callbacks that collect the store URL and the active module name. | Delivery by account, without a key per store, works. Its Advanced Subscription Products is a SaaS at $50/mo: run your renewals on it and the vendor holds a kill switch on your dependency. |
| Hyvä, Sylius | Private Packagist for Vendors delivers the code per customer, per version, with an expiry date. | Enforcement sits in code delivery, and nothing has to be checked inside the store. |
| Keygen | Licensing as a service. | Licenses bind to a machine fingerprint, so binding to a domain is a convention you keep yourself. |
The warning example: in May 2025 Sansec reported a backdoor in 21 extensions on 500 to 1000 stores, dormant for 6 years. It lived in a file called License.php and used include_once($licenseFile).
The same vendors from the merchant's side are in my notes on Amasty's license registration and Aheadworks' license terms.
Your options
License server
- Cloudflare Workers + D1. £0 on the no-cost tier, nothing to operate. About 200 requests a day against a 100,000 limit, and Ed25519 is built in. My recommendation.
- Workers paid, $5/mo. Same thing without the daily limit of the no-cost tier.
- PHP app on a VPS, about £5/mo. You own kernel updates, backups and uptime. Only if the team insists on PHP.
- Keygen. $0 up to 100 licenses, then $99/mo, nothing to operate. Viable if you prefer to buy; domain binding stays a convention.
- Inside your own Magento shop. Do not: one
setup:upgradetakes licensing down for every customer at once.
Code delivery
- Private Packagist for Vendors. Lowest setup, nothing to operate, and the data model is exactly customer, package, version, expiry. My recommendation. The price I have is €59/mo with the first 59 customers included, then €1 each; check with them whether that plan is standalone or needs an organization plan under it.
- Own Cloudflare Worker + R2. £0, low setup, low ops, and R2 does not charge for egress. The fallback.
- Packeton, self-hosted, MIT. Costs a VPS, medium setup, and you own the uptime of every customer's deploy path. Only if SaaS is refused.
- Satis. £0, highest setup and ops. It has no access control at all, so you build the auth layer.
- Gitea or GitLab package registry. £0, low setup. Permissions are per user and there is no concept of expiry.
Renewals
Magento has no recurring billing in any edition; I checked the 2.4.8 source and there is no scheduler.
- Renewal as another order for a renewal SKU. No extra infrastructure. My recommendation.
- Stripe subscriptions through the Stripe connector. Needs Stripe Billing.
- A SaaS subscription engine such as the Aheadworks one, $50/mo. A third party gets a kill switch on your renewals.
My universal setup
One rule shapes everything: the Composer repository enforces the license, and the base module only records and displays. PHP ships as source, so a check inside the module can be deleted in five minutes, and encoding does not help because Magento's DI lets anyone override the class.
License server
On its own domain, license.example.com, with a webhook from the payment provider: paid issues a key, refunded revokes it.
| Table | Columns |
|---|---|
licenses | id, key, customer_id, product_sku, state, use_rights, updates_until, created_at, revoked_at |
installations | id, license_id, install_date, primary_host, all_hosts, magento_version, php_version, is_production, first_seen, last_seen |
events | id, license_id, type, payload, created_at |
| Endpoint | Called by | What it does |
|---|---|---|
POST /activate | CLI or one admin button, once | Receives the key, install date, all store hostnames, Magento and PHP versions, mode and your installed modules. Returns an instance id and a signed assertion. |
POST /check | Cron, once a day | Receives instance id, key and a hash of that state. Under 300 bytes when nothing changed. Returns a fresh assertion. |
POST /deactivate | CLI | Releases the installation slot. Returns 204. |
GET /keys | Nobody at runtime | Lists public keys so a later module version can pin a new one. |
Key and signed assertion
Key format: ACME-K7QW-2H8T-M4KD-A93F-X. A prefix so support can grep it, 16 characters of Crockford base32 (80 bits, no I, L, O, U, case-insensitive) and 1 check character, so the admin form rejects a typo before any network call. One key per customer; the same string is the Composer password in auth.json, never in the repository URL.
The server signs every answer with Ed25519. The private key stays on the server, the public key is a PHP constant in the base module, and the module caches the assertion in its own table in the store database:
{
"lic": "ACME-K7QW-2H8T-M4KD-A93F-X",
"inst": "ins_01J9Q4V7WZ8M3KDA",
"primary": "example.com",
"env": "production",
"iat": 1756039327,
"exp": 1758631327,
"refresh_after": 86400,
"state": "active",
"checks_enabled": true,
"ent": [
{ "sku": "Acme_OrderNotes", "use": true, "updates_until": 1787536000 }
],
"messages": []
}
expis 30 days after issue.refresh_afterslows every client down with one server change.checks_enabled: falseturns off all license notices without a module release.useis the right to run the code,updates_untilthe right to newer versions.messages[]is text written by the server; the module only displays it.
With a signature, forging active means editing vendor PHP, which composer update overwrites. ext-sodium is already required by magento/framework, and verification measured 0.023 ms.
Base module: hard rules
- No HTTP call in any web request path. Cron and one admin button only, 5 seconds to connect, 10 seconds total, in its own cron group and never in
default. - Never disable TLS verification.
- The response is data, never code. No
include, noeval, nounserialize, no writing files. - Send every store hostname. Publish the full list of what is sent: key, instance id, hostnames,
install/date, your module codes and versions, Magento version and edition, PHP version, production flag. Nothing else. - Store the state in your own table.
cache:flushmust not trigger a call from every customer at once. - Nothing runs during
setup:upgrade,di:compile,static-content:deployorcomposer install. - Trigger only on "the server said no". On a timeout, DNS failure, 5xx or TLS error nothing changes; after 35 days without a successful check the admin sees "could not verify" and everything still works.
- On a signed negative the admin area degrades and the storefront stays untouched.
- Never take away the right to run the code because a card failed.
past_dueshows the customer nothing;expired, after 14 days of failed dunning, blocks only new versions. - Every revoke is a human decision. Only
refunded,charged_backandrevokedremove the right to use.
Composer expiry
Versions released after the expiry date are not served. Everything released before it stays installable, and the token keeps working: a dead token fails composer install in a clean CI container and breaks the customer's deploy. Renewal is one API call that moves the date forward.
Two things break if you skip them:
magento/composer-dependency-version-audit-plugin, shipped with Magento since 2.4.3, halts installation when a private repository offers a lower version than packagist.org. A version-capped subscription looks exactly like that. Never publish your package names on packagist.org.- Namespace squatting: someone publishes
acme/module-ordernotes99.0.0publicly and hijacks every customer'scomposer update. Register theacme/prefix on packagist.org with one trivial package.
Order of work
- License server: database,
/activate,/check, signing. - Entitlement record: who bought what, which version, until when. The only thing that is painful to backfill after 100 sales.
- Authenticated download and the key in the order email. The first sale is possible here.
- Private Composer repository with credentials per customer.
- Base module: registration, status, CLI.
- Renewals, dunning and refunds, once there is a renewal base.
Do not build
- A storefront kill switch, even behind a flag.
- Automated revocation on any signal.
- ionCube, SourceGuardian or obfuscation. See the FAQ.
- Hardware or database fingerprinting. It means nothing under containers.
- License keys per module. One key per customer, entitlements inside the assertion.
- JWKS, nonce protocols, encrypted request bodies, certificate pinning. TLS already does it, and the attacker owns the client.
If you want this built for your extensions, I can help
I build this setup for vendors and agencies with Claude Code: the license server, the base module, the Composer repository and the release pipeline around them. Claude Code writes, I review every line, so the whole setup takes days. I am an ex-Magento 2 core engineer, the scope is fixed before work starts, and I bill by the hour for the hours worked. Contact me with how many extensions you have and where you sell them; my rate is on the pricing page.
FAQ
Can a license check inside a Magento 2 module be bypassed?
Yes. PHP ships as source and DI lets anyone override a class, so the check can be removed in minutes. Enforce the license in the Composer repository and use the module to record and display.
Should an extension stop working when the license expires?
No. expired keeps the right to run the code and blocks only new versions.
Do I need ionCube or obfuscation?
No. Adobe rejects encrypted extensions from the Marketplace, Commerce Cloud needs a support ticket with 48 hours' notice per environment, and DI overrides defeat the encoding anyway.