The Marketplace lists, it does not sell
If you publish a VS Code extension for money, you are on your own for payment. The publishing docs offer an optional pricing property in package.json whose allowed values are Free and Trial, defaulting to Free. There is no paid value. In a public discussion on the Marketplace repository, a member of the VS Code team wrote that “we don’t have any plans on having ‘for pay’ extensions”, and that discussion is where developers with paid extensions ask how to label them.
So the model is: list the extension on the Marketplace, set "pricing": "Trial" if it has a free trial, state the price and where to buy in the README, and sell through Stripe. The extension checks the license. Other plugin platforms do sell for you, such as JetBrains and Figma, and there selling inside the store may be the better choice. VS Code has no such option, so a payment link on your own site is the way.
What is specific to VS Code
Secrets. The SecretStorage API stores sensitive data and, per the API reference, secrets are not synced across machines. Keep the key, the instance id and the latest token there. The key never needs to appear in settings.
A machine id is built in. vscode.env.machineId is a string that identifies the machine. Hash it and send the hash as fingerprint, so reinstalling VS Code on the same computer returns the same seat.
Remote development changes what “machine” means. VS Code can run an extension host remotely, in a container, over SSH, in WSL or in a Codespace. Where the extension runs depends on where it is installed and on the extensionKind property. An extension that runs on the remote host sees the remote machine’s id, so one developer using five dev containers looks like five devices. Declare "extensionKind": ["ui"] if the license check can live in the local UI extension, which makes it run on the user’s own computer. If the extension must run remotely, send a stable id of your own and set the device limit with that in mind.
Web and desktop hosts differ. In VS Code for the Web, an extension runs in a worker with no Node.js, no child processes, and only the Fetch API, and resources must support CORS. The License API allows cross-origin requests from any origin, so fetch works there too. Write the licensing code with fetch and Web Crypto, or a pure-JavaScript Ed25519 library, and it runs in both.
Readable code. An extension is JavaScript that anyone can open. The check is a way to keep honest users honest, and the thing you really sell is updates and support.
Recommended setup
| Setting | Suggested value | Why |
|---|---|---|
| License type | Annual subscription, or perpetual with paid major versions | Extensions need continuous maintenance as VS Code changes |
| Device limit | 3, or 5 if remote use is common | Laptop, desktop and remote environments |
| Trial | 14 days from first use, "pricing": "Trial" |
The Marketplace label tells users there is a trial |
| Updates | The Marketplace delivers updates | Clavem only decides whether the paid features run |
Updates are the one area where Clavem is not in the path. The Marketplace pushes new versions to every installed copy, licensed or not, so you cannot withhold an update from an unpaid user. What you can control is what the new version does without a valid key.
A trial without a license
Start the trial on first activation, store the start date in globalState or SecretStorage, and show the remaining days in the status bar. After 14 days, switch the paid commands off and show a link to your checkout. No Clavem license exists until someone pays, which keeps the license count for buyers.
For a fixed-length trial that needs a key, create a license from the management API with a short expires_at. That counts against your plan like any other license.
Doing this with Clavem
Create a product, connect Stripe, map the Stripe product. A buyer gets a key and an order page. In the extension, a command such as Yourext: Enter License Key takes the key, calls activate with instance_name set to the machine’s hostname, and stores the result. At startup, validate runs in the background with a timeout and falls back to the stored token. The VS Code guide has this flow; the offline guide covers token verification.
Guides to follow
- License key validation for VS Code extensions
- Offline license verification for VS Code extensions
- License key validation in Node.js
Questions
Can I sell a paid extension on the Visual Studio Marketplace?
Not through the Marketplace. Its publishing docs let you show a pricing label of Free or Trial, and a Microsoft team member wrote in a public discussion that there were no plans for for-pay extensions. You list the extension there and sell the license elsewhere.
Where should an extension store the license key?
In the SecretStorage API, which keeps secrets in the operating system's store and does not sync them across machines. Do not put a key in settings.json, which users sync and paste into bug reports.