# How to Sell WordPress Plugins with License Keys

> Sell WordPress plugins with license keys: set activation limits, deliver keys at checkout, validate sites via API, and gate updates to paying customers.
- **Author**: Ayush Agarwal
- **Published**: 2026-03-29
- **Category**: Payments, License Keys, How-To
- **URL**: https://dodopayments.com/blogs/en/sell-wordpress-plugins-license-keys

---

To sell a WordPress plugin with license keys, you need three things: a checkout that issues a unique key on every purchase, an activation screen in your plugin that checks that key against a license API, and an update server that only ships new versions to sites with a valid key. Dodo Payments covers the checkout, key generation, key delivery, and the public license API, so the only part you build is the WordPress side.

The WordPress plugin economy is massive, and premium plugins generate real revenue for independent developers. But setting up a license system and payment flow from scratch is a painful distraction from actually building the plugin. Most developers want to focus on code, not on building a custom billing engine or a secure license validation server.

In this guide, we will walk through the complete process of selling premium WordPress plugins with license keys. We will cover everything from choosing a monetization model to implementing a secure validation system using Dodo Payments. By the end of this article, you will have a clear roadmap for launching your premium plugin and scaling your revenue without the marketplace overhead.

## WordPress Plugin Monetization Models

Before you write a single line of licensing code, you need to decide how you want to charge for your plugin. The WordPress ecosystem has several established models that work well for different types of products. Choosing the right one depends on your target audience and the value your plugin provides.

> License key management looks simple until you need activation limits, device tracking, and expiration logic across thousands of customers. Building this yourself is a distraction from your core product.
>
> \- Ayush Agarwal, Co-founder & CPTO at Dodo Payments

### The Freemium Model

This is the most popular model in the WordPress world. You offer a feature-limited version of your plugin for free on the WordPress.org repository. This free version acts as a powerful marketing tool, reaching millions of potential users. You then offer a "Pro" version on your own website that includes advanced features, premium support, and automatic updates.

Agencies are worth thinking about separately here. A [WordPress web design agency](https://www.chromatix.com.au/web-design/) deploying the same plugin across many client sites is usually the buyer for your top tier, which is why multi-site and developer licences tend to carry the best margins.

The freemium model works because it builds trust. Users can try the basic functionality before they commit to a purchase. When they are ready for more power, they upgrade to the premium version. This model requires a solid [software license management](https://dodopayments.com/blogs/software-license-management) strategy to ensure that only paying users can access the Pro features.

### Direct Sale Model

In this model, you do not offer a free version on the official repository. Instead, you sell the plugin exclusively through your own website. This is common for niche plugins that solve specific, high-value problems for businesses. Since there is no free version to act as a lead magnet, you rely on SEO, content marketing, and paid ads to drive traffic to your landing page.

### Marketplace Model

Marketplaces like CodeCanyon or ThemeForest handle the traffic and payments for you. They provide a platform where users are already looking for solutions. In exchange, they take a large commission on every sale (check the marketplace's current author fee schedule, since rates depend on exclusivity and author level). You also lose direct access to your customers, making it harder to build a long-term brand.

While marketplaces are great for getting started, most successful plugin developers eventually move toward selling directly. Owning the platform allows you to implement [subscription vs license model](https://dodopayments.com/blogs/subscription-vs-license-model) experiments and keep 100% of your revenue after payment processing fees.

## Why Sell Directly with License Keys

Selling directly from your website is the gold standard for serious WordPress developers. It allows you to build a sustainable business that you fully control. License keys are the bridge that makes this possible, providing a way to verify purchases and protect your intellectual property.

### Control Your Pricing and Margins

When you sell on a marketplace, you are often forced into their pricing tiers. When you sell directly, you can charge whatever you want. You can offer tiered pricing based on the number of sites, lifetime deals, or annual subscriptions. This flexibility is crucial for maximizing your [recurring revenue](https://dodopayments.com/blogs/recurring-revenue).

### Own the Customer Relationship

Marketplaces often hide customer data from you. When you sell directly, you own the email list. You can send product updates, educational content, and cross-sell other plugins. This direct line of communication is the most valuable asset any software business can have.

### Higher Security and Update Control

License keys allow you to control who gets access to your updates. Without a license system, anyone who gets a copy of your plugin can use it forever and potentially share it with others. By requiring a valid key for updates, you ensure that only active customers get the latest security patches and features.

## Why Dodo Payments for WordPress Plugins

Setting up a license server is hard. You have to handle database management, API security, and high availability. Dodo Payments simplifies this by providing a built-in license key system that integrates directly with your checkout.

### Automated License Key Lifecycle

Dodo Payments handles the entire lifecycle of a license key. When a customer completes a purchase, Dodo automatically generates a unique key and sends it to them in a professional email. You don't have to write any code to handle the generation or delivery of keys.

This automation extends to renewals and expirations. If a customer cancels their subscription, Dodo can automatically invalidate their license key. This ensures that your [how to sell software online](https://dodopayments.com/blogs/how-to-sell-software-online) process is completely hands-off.

### Public License API

One of the biggest challenges in WordPress licensing is making API calls from the user's server to yours. Dodo provides a public License API that does not require a secret key for validation and activation. This means you can safely call the API directly from your plugin's PHP code without exposing your master API credentials.

This architecture is both secure and easy to implement. You can use the [License Keys documentation](https://docs.dodopayments.com/features/license-keys) to find the exact endpoints for activation and validation. This makes Dodo the [merchant of record for saas](https://dodopayments.com/blogs/merchant-of-record-for-saas) that actually understands the needs of developers.

### Global Tax and Compliance

Selling globally means dealing with VAT, GST, and sales tax in hundreds of jurisdictions. Dodo Payments acts as your Merchant of Record, meaning we handle tax collection and remittance in 190+ countries for you. You get one payout, and we take care of the compliance headaches. EU VAT applies to digital products from the first consumer sale, which [VAT compliance for digital products](https://dodopayments.com/blogs/vat-compliance-digital-products) explains.

Pricing is 4% + 40c per domestic US transaction, plus 1.5% for international payments and 0.5% for subscriptions, with license keys and digital delivery included and no monthly fee. Disputes are $30 each, which is worth knowing if you are comparing against the [Stripe dispute fee](https://dodopayments.com/blogs/stripe-dispute-fee) on a self-run stack. A clear refund policy and a recognizable statement descriptor prevent most plugin chargebacks before they start, as covered in [chargeback prevention for SaaS](https://dodopayments.com/blogs/chargeback-prevention-saas).

## Step-by-Step Guide to Selling Your Plugin

Now that we understand the "why," let's look at the "how." Implementing a licensing system with Dodo Payments is a straightforward process that can be completed in a few hours.

### 1. Create Your Product in Dodo

The first step is to log into your Dodo Payments dashboard and create a License Key entitlement under **Entitlements**. This is where you configure how each issued key behaves: the activations limit, the license length, and an optional activation message that is included in the key delivery email. You then attach that entitlement to your product. For example, you might create a "Single Site" entitlement with 1 activation and a "Business" entitlement with 5 activations, and attach each to the matching plan.

You can also choose between one-time payments and [subscriptions](https://docs.dodopayments.com/features/subscription). Most WordPress plugins use an annual subscription model to provide ongoing updates and support. Dodo handles the recurring billing automatically, and keys issued for a subscription stay valid for as long as the subscription is active.

### 2. Build Your Landing Page

Your landing page is where you convince users to buy your plugin. It should clearly state the problem your plugin solves and the benefits of the premium version. Use high-quality screenshots, videos, and testimonials to build credibility.

Make sure your pricing table is clear. Explain the difference between your tiers and what is included in each. This is a great place to link to your [how to accept online payments](https://dodopayments.com/blogs/how-to-accept-online-payments) documentation if you are building a custom checkout flow.

### 3. Add Dodo Checkout

Dodo offers several ways to accept payments. The easiest is to use a payment link that you can add to your "Buy Now" buttons. When a user clicks the button, they are taken to a secure, hosted checkout page that is optimized for conversions.

Alternatively, you can use the Dodo Overlay checkout. This keeps the user on your site and opens a modal for the payment. This provides a smoother experience and can lead to higher conversion rates. You can find more details in the [integration guide](https://docs.dodopayments.com/developer-resources/integration-guide).

### 4. Automated Key Delivery

Once the payment is successful, Dodo takes over. The customer receives an email with their receipt and their unique license key. You can also redirect the customer to a "Thank You" page on your site where you display the license key and a download link for the Pro version of the plugin. Dodo appends the generated key to your return URL as a `license_key` query parameter, so the thank-you page can show it without an extra API call. If you want Dodo to host the Pro zip as well, [digital product delivery](https://docs.dodopayments.com/features/digital-product-delivery) can attach the download to the same purchase.

### 5. Add Activation Screen in WordPress

Inside your plugin, you need to create a settings page where users can enter their license key. This is usually done using the WordPress Settings API. You should provide a simple text input and an "Activate" button.

When the user clicks activate, your plugin will send a request to the Dodo License API. If the key is valid and has remaining activations, Dodo will return a success response. You should then store the license key and an activation instance ID in the WordPress database.

### 6. Validate via License API

Validation should happen periodically to ensure the license is still active. You don't want to check on every page load, as that would slow down the user's site. Instead, you can use a WordPress cron job to check the license once a day or once a week.

### 7. Tie License to Domain

To prevent users from sharing a single-site license across multiple domains, you should tie the activation to the site's URL. When you call the Dodo activation endpoint, you can pass the site URL as the "name" of the activation instance.

### 8. Handle Auto-Updates

One of the biggest benefits of a premium plugin is automatic updates. WordPress has a built-in system for updates, but it defaults to the official repository. To serve updates from your own server, you need to hook into the `pre_set_site_transient_update_plugins` filter.

Before you provide the update package, you should verify that the site has a valid license key. This ensures that only paying customers get the latest version of your code. You can use [webhooks](https://docs.dodopayments.com/developer-resources/webhooks) to notify your update server when a license is renewed or canceled.

## How License Validation Works with Dodo License Keys

It helps to know exactly what the Dodo License Keys API does at each stage, because your plugin's error messages and admin notices should map to those states.

**Activation.** Your plugin calls `/licenses/activate` with the key and a `name` (use the site URL). Dodo creates an activation instance and returns its ID, which starts with `lki_`. Store that ID, because deactivation needs it. The endpoint returns `403` if the key is not active, `404` if the key does not exist, and `422` if the key has already used all of its activations. Map `422` to a message like "This license is active on the maximum number of sites. Deactivate it on another site or upgrade your plan."

**Validation.** `/licenses/validate` returns `valid: true` when the key is active and has not expired. Pass the stored `license_key_instance_id` too, so the check also confirms that this specific site's activation still exists. If a customer deactivates the site from another install, the next scheduled check will catch it.

**Deactivation.** `/licenses/deactivate` takes the key and the instance ID and frees one activation. This is what powers a "Move license to another site" button.

**Lifecycle events.** You do not have to track renewals yourself. For subscription products, keys have no expiry date and follow the subscription status: they stay active through renewals and through the grace period when a renewal is past due, they are disabled while a subscription is on hold or paused, and they are disabled permanently when the subscription is cancelled or expires. A plan change disables the old keys and issues new ones for the new plan, and a refund on a one-time purchase disables the key. If you also run your own update server, listen for the `entitlement_grant.*` webhook events so your server's view of each license stays in sync.

All three runtime endpoints are public, so your plugin never needs your secret API key. For a broader look at designing key formats and activation rules, see our guide to [setting up a license key system](https://dodopayments.com/blogs/set-up-license-key-system).

## Licensing Workflow Diagram

The following diagram illustrates the complete flow from the initial purchase to the ongoing license validation and update process.

```mermaid
flowchart TD
    A[User Buys Plugin on Website] --> B[Dodo Generates License Key]
    B --> C[Key Emailed to User]
    C --> D[User Enters Key in WP Admin]
    D --> E{Plugin Calls Dodo API}
    E -->|Valid| F[Plugin Activated & Pro Features Enabled]
    E -->|Invalid| G[Show Error Message]
    F --> H[Daily Background Validation]
    H --> I{Is License Still Valid?}
    I -->|Yes| J[Continue Access]
    I -->|No| K[Lock Features & Show Notice]
    J --> L[Check for Updates]
    L --> M{Valid License?}
    M -->|Yes| N[Serve Update Package]
    M -->|No| O[Deny Update]
```

## PHP Code Example for WordPress

Here is a simplified example of how you can implement license activation in your WordPress plugin using the Dodo Payments API. This code uses the `wp_remote_post` function to communicate with Dodo.

```php
<?php
/**
 * Activate the license key with Dodo Payments
 */
function dodo_activate_license($license_key) {
    $url = 'https://live.dodopayments.com/licenses/activate';

    $response = wp_remote_post($url, array(
        'body' => json_encode(array(
            'license_key' => $license_key,
            'name'        => get_site_url(), // Tie to domain
        )),
        'headers' => array(
            'Content-Type' => 'application/json',
        ),
    ));

    if (is_wp_error($response)) {
        return $response; // Network error: pass the WP_Error through
    }

    $code = wp_remote_retrieve_response_code($response);

    if ($code === 422) {
        // Activation limit reached for this key
        return new WP_Error('limit_reached', 'This license is already active on the maximum number of sites.');
    }

    $body = json_decode(wp_remote_retrieve_body($response), true);

    if (isset($body['id'])) {
        // Store the instance ID and key in the database
        update_option('my_plugin_license_key', $license_key);
        update_option('my_plugin_license_instance_id', $body['id']);
        return true;
    }

    return new WP_Error('activation_failed', 'This license key could not be activated.');
}

/**
 * Example caller: returns true on success, WP_Error on any failure
 */
$result = dodo_activate_license(sanitize_text_field($_POST['license_key']));
if (is_wp_error($result)) {
    add_settings_error('my_plugin', $result->get_error_code(), $result->get_error_message());
} else {
    add_settings_error('my_plugin', 'activated', 'License activated.', 'success');
}

/**
 * Validate the license key periodically
 */
function dodo_validate_license() {
    $license_key = get_option('my_plugin_license_key');
    $instance_id = get_option('my_plugin_license_instance_id');

    if (!$license_key || !$instance_id) {
        return false;
    }

    $url = 'https://live.dodopayments.com/licenses/validate';

    $response = wp_remote_post($url, array(
        'body' => json_encode(array(
            'license_key'             => $license_key,
            'license_key_instance_id' => $instance_id,
        )),
        'headers' => array(
            'Content-Type' => 'application/json',
        ),
    ));

    $body = json_decode(wp_remote_retrieve_body($response), true);

    return isset($body['valid']) && $body['valid'] === true;
}

/**
 * Deactivate this site so the activation can be reused elsewhere
 */
function dodo_deactivate_license() {
    $response = wp_remote_post('https://live.dodopayments.com/licenses/deactivate', array(
        'body' => json_encode(array(
            'license_key'             => get_option('my_plugin_license_key'),
            'license_key_instance_id' => get_option('my_plugin_license_instance_id'),
        )),
        'headers' => array(
            'Content-Type' => 'application/json',
        ),
    ));

    $code = is_wp_error($response) ? 0 : wp_remote_retrieve_response_code($response);

    if ($code >= 200 && $code < 300) {
        delete_option('my_plugin_license_instance_id');
        return true;
    }

    return false;
}
?>
```

This code provides a solid foundation for your licensing system. You can expand it by handling the remaining API responses, such as `403` for a key that is no longer active and `404` for a mistyped key, with clear admin notices for each. For more advanced implementations, check the [Dodo Payments SDKs](https://docs.dodopayments.com/developer-resources/dodo-payments-sdks).

## Tips for Successful Plugin Licensing

Implementing the code is only half the battle. You also need to think about the business logic and user experience of your licensing system.

### Single-Site vs Multi-Site Licenses

Activation limits are your main pricing lever. A common WordPress ladder is 1 site for a personal tier, 3 to 5 sites for a business tier, and a high limit or unlimited activations for an agency or developer tier. In Dodo, each tier is a separate License Key entitlement with its own activations limit, so upgrading a customer to a bigger tier is a plan change rather than a manual key edit.

Decide early how you count sites. Most plugin developers do not want a staging copy or a local development install to burn an activation, so the usual pattern is to skip the activation call when the site URL matches `localhost`, `.local`, `.test`, or a `staging.` subdomain, and to document that rule on your pricing page. Be just as explicit about multisite networks: say whether one key covers the whole network or each subsite counts as one activation.

Agencies are the buyers most likely to hit limits, so make the upgrade path obvious. When activation returns the limit error, show the current tier, the number of sites in use, and an upgrade link in the same notice. That converts a support ticket into an upsell.

### Handling License Renewals

Subscriptions are the best way to handle renewals. By default, Dodo will charge the customer every year and keep their license active. Because subscription keys follow the subscription status, a key stays active while a renewal is past due and is disabled automatically if the subscription is cancelled, so you never have to run a separate expiry job.

Failed renewals are the quiet leak in plugin revenue, since many customers pay once a year with a card that has since expired. Dodo's [subscription dunning](https://docs.dodopayments.com/features/recovery/subscription-dunning) retries the payment and emails the customer; it is free to enable, and you pay 5% only on revenue it actually recovers. Our guide to [involuntary churn from failed payments](https://dodopayments.com/blogs/involuntary-churn-failed-payments) covers how much of that revenue is recoverable.

If you prefer the classic "lifetime license, one year of updates" model, sell a one-time product and set the entitlement's license length to one year. The key then expires after a year, your update check sees `valid: false`, and you can keep the installed version working while prompting the customer to renew for new releases. For pricing ideas across both plugins and themes, see our guide to [selling WordPress plugins and themes](https://dodopayments.com/blogs/sell-wordpress-plugins-themes).

### Deactivation on Site Change

Users often move their sites from a staging environment to production. Your licensing system should allow them to deactivate a key on one site so they can use it on another. You can add a "Deactivate" button to your plugin settings that calls the Dodo deactivation endpoint.

## FAQ

### Can I use Dodo Payments with a free plugin on WordPress.org?

Yes. You can keep your free version on the official repository and sell the Pro version through your own site using Dodo. This is the standard freemium model used by thousands of successful plugins.

### How do I handle taxes for international customers?

Dodo Payments is a Merchant of Record. We automatically calculate, collect, and remit sales tax and VAT for every transaction based on the customer's location, across 190+ countries. You don't have to worry about tax compliance in different countries.

### What happens if a customer cancels their subscription?

When a subscription is cancelled or expires, Dodo disables the license keys issued for it, so your next validation check returns `valid: false`. Dodo also sends webhook events, which you can use to update your own update server or show a renewal notice inside the plugin.

### Is the Dodo License API secure to call from PHP?

Yes. Dodo provides public endpoints for activation and validation that do not require a secret API key. This allows you to call them safely from the client-side or from a user's WordPress server without risking your account security.

### Can I limit the number of sites a license can be used on?

Yes. You set an activations limit on the License Key entitlement attached to each product, such as 1 for a single-site plan or 5 for a business plan. When a key has used all of its activations, the activate endpoint returns a 422 error, and the customer can free a slot by deactivating an old site.

## Final Take

Selling WordPress plugins with license keys doesn't have to be a technical nightmare. By using a dedicated platform like Dodo Payments, you can automate the hard parts of licensing, payments, and tax compliance. This allows you to focus on what you do best: building great software for the WordPress community.

Whether you are launching your first plugin or scaling an existing business, owning your platform is the key to long-term success. With the right licensing strategy and a reliable partner like Dodo, you can build a profitable, sustainable business that stands the test of time. Ready to get started? Check out our [pricing](https://dodopayments.com/pricing) and sign up for a free account today.
---
- [More Payments articles](https://dodopayments.com/blogs/category/payments)
- [All articles](https://dodopayments.com/blogs)