How to Add Software Licensing to your Plugin Using Easy Digital Downloads

to be continued sigange
Photo by Reuben Juarez on Unsplash

Creating your own plugin is tough and it’s tougher to sell! I know! I have one plugin for sale over at BB Vapor Modules, and they honestly haven’t been selling well, but time will tell.

I use Easy Digital Downloads because it makes the shopping experience much nicer and it has a plethora of options. Easy Digital Downloads and software licensing do not work out of the box, however. You’ll need some extensions, and I’ll go over that here.

Pre-Requisite Extensions

All of these add-ons are expensive on their own, which is why I highly recommend just getting the Easy Digital Downloads All Access Pass, which gives you access to all extensions for unlimited sites. It’s a must-own product.


Turn on SSL via Let’s Encrypt. If your hosting doesn’t offer free SSL certificates, it’s time to move to a better host. I’m currently hosted on Kinsta and it’s been a great service. SiteGround and WP Engine also offer free SSL certificates.

Auto Register Add-On

You’ll want your users to be able to log in and view past purchases. This is why I recommend the Auto Register Add-On.

Custom Prices Add-On

If you have any kind of donate form or pay me what you want, then you’ll want the Custom Prices Add-On. I use it on my Give Back section.

Discounts Pro Add-On

If you want to apply discounts to a product group over a period of time, this plugin is a must. I highly recommend the Discounts Pro Add-On.

Manual Purchases Add-On

If you want to send out trials to members or invite others to review your plugin, this add-on is a must. I’ve used Manual Purchases numerous times to invite others to try my products.

Recurring Payments Add-On

If you’re needed a per-year or per-month (or any time) recurrence, then the Recurring Payments Add-On is a no-brainer.

Software Licensing Add-On

This is the meat. You’ll need the Software Licensing Add-On to allow you to sell your product digitally.

Finally, the Stripe Payment Gateway Add-On

If you use Stripe, and I don’t see why not, you’ll want the Stripe Payment Gateway Add-On.

Adding Software Licensing to Your Plugin

Once you download the Software Licensing Add-On, you’ll find a samples directory. From there, it has an example of how to include the class into your plugin or theme. In this case, I’m concentrating on the plugin side of things.

You’ll find that you need to include the file EDD_SL_Plugin_Updater.php in your plugin. I typically just throw this into an includes folder in my plugin. Once thing to note here is that other plugins may be using the same class name, so I recommend wrapping it with a class_exists check.

if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ): class EDD_SL_Plugin_Updater { ... } endif;
Code language: PHP (php)

From there, include and instantiate the class. I’m assuming you have a base plugin file and the updater class in an includes folder.

// Auto Update class define( 'YOUR_PLUGIN_VERSION', '1.0.1' ); add_action( 'admin_init', 'your_plugin_updater_init', 0 ); function your_plugin_updater_init() { require_once 'includes/EDD_SL_Plugin_Updater.php'; $license = get_site_option( 'your_plugin_license', false ); if ( false !== $license ) { // setup the updater $edd_updater = new EDD_SL_Plugin_Updater( '', __FILE__, array( 'version' => YOUR_PLUGIN_VERSION, 'license' => $license, 'item_id' => 123, 'author' => 'Your Name', 'beta' => false, 'url' => home_url(), ) ); } }
Code language: PHP (php)

I’m assuming you have an option named your_plugin_license and a constant named YOUR_PLUGIN_VERSION. You’ll also want to point to whatever domain you are selling your licenses from. Setting the item_id will require that you add the download to your domain first. This is a chicken and egg scenario, but you can draft a download and steal the ID it generates.

For example, here’s mine for my plugin BB Vapor Modules for Beaver Builder.

require_once BBVAPOR_PRO_BEAVER_BUILDER_DIR . 'includes/EDD_SL_Plugin_Updater.php'; $license = get_site_option( 'bbvm_for_beaver_builder_license', false ); if ( false !== $license ) { // setup the updater $edd_updater = new BBVM_EDD_SL_Plugin_Updater( '', BBVAPOR_PRO_BEAVER_BUILDER_FILE, array( 'version' => BBVAPOR_PRO_BEAVER_BUILDER_VERSION, 'license' => $license, 'item_id' => 688, 'author' => 'Ronald Huereca', 'beta' => false, 'url' => home_url(), ) ); }
Code language: PHP (php)

I’ve placed the EDD Updater class in its own includes directory and changed the class name so it doesn’t conflict with other plugins using the EDD Plugin Updater.

Here’s an example of customizing the class name.

<?php // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; /** * Allo