Software Licensing – Common Issues and FAQs
The Software Licensing Extension for Easy Digital Downloads requires some setup and integration – and it is possible that you may experience some issues. A few of those are outlined here with potential solutions.
Table of Contents
FAQs
Does Software Licensing work with Amazon S3?
Yes, it’s fully compatible with no issues and no special settings.
Do local / development environments impact activation count?
If you choose to limit the number of license activations a customer may have, it’s still possible to allow them to activate a license on their local development environment without impacting their activation count.
This allows your users to easily stay up to date in their testing and development environments while not getting free license activations.
In order for this to work two things need to happen:
1) Ignore Local Host URLs
In your WordPress admin, under
Downloads → Settings → Extensions → Software Licensing look for a checkbox that says Ignore Local Host URLs. Make sure that’s checked.
2) Educate Customers
See this guide on how to ignore activations for development sites.
How do you create custom license key formats?
EDD License Keys are by default an md5 sum like this:
e0c7ccc47b2613c82d1073a4214deecc
If you wish to have something else, with
Software Licensing it’s as easy as making a function to create consistent unique keys and hooking into a filter called edd_sl_generate_license_key.
License key formats can really be anything you wish, as long as they’re unique and consistent. If you want keys in this format:
username_timestamp_licensekey sdavis2702_20151015120022_e0c7ccc47b2613c82d1073a4214deecc
You can use this function:
// Example shown how to base the MD5 off of the user's email and purchase date function pw_edd_license_md5_user_and_date( $key, $license_id, $download_id, $payment_id, $cart_index ) { $name = get_user_by( 'email', edd_get_payment_user_email( $payment_id ) ); $date = get_post_field( 'post_date', $payment_id ); $timestamp = strtotime($date); $nice_date = date( 'Yndhis', $timestamp ); $license = md5( $license_id ); $key = $name->user_nicename . '_' . $nice_date . '_' . $license; return $key; } add_filter( 'edd_sl_generate_license_key', 'pw_edd_license_md5_user_and_date', 10, 5 );
A simpler function uses only username and license key:
// prepend user's username to license key function sd_edd_license_username_md5( $key, $license_id, $download_id, $payment_id, $cart_index ) { $name = get_user_by( 'email', edd_get_payment_user_email( $payment_id ) ); $license = md5( $license_id ); $key = $name->user_nicename . '_' . $license; return $key; } add_filter( 'edd_sl_generate_license_key', 'sd_edd_license_username_md5', 10, 5 );
The most important thing to take from this document is that you can use any code that produces consistent unique strings and use those strings as license keys.
Plugin Option
There’s also a free plugin which provides a meta box on each Download, allowing you to set a custom format for each Download without having to write code. It’s called
EDD License Key Template. Here’s a screenshot of the meta box in the admin area.
Showing a list of Customer’s license keys
The following code will allow you to retrieve and display a list of license keys for a specific Customer.
Note: The “$customer->id” should be replaced with the actual Customer ID.
$licenses = edd_software_licensing()->licenses_db->get_licenses( array( 'number' => -1, 'customer_id' => $customer->id, 'orderby' => 'id', 'order' => 'ASC', ) );
What happens if the domain of my store goes down?
Software Licensing includes which has a class named EDD_SL_Plugin_Updater
. If you are including the latest version of this class it has a built in ‘health check’, so that if your site is not responding to the API requests made by your software, plugin, or theme it will not try again for a few hours later. If you intend to change domains or shut down a domain name, it would be best to release an update that uses the new domain or removes the calls to the API all together.
Common Issues
Customize Sample Code
The sample code that comes with Software Licensing has function prefixes like edd_
and edd_sl_
. These should be changed to match your own plugin, and search-and-replace is an excellent way to do it, but you need to be careful of your search string.
There are functions with prefixes like edd_action_
that should not be changed. Make sure you’re only changing your own function name prefixes, and not EDD core prefixes.
Icons not showing on the Plugin Update screen
In version 3.6.5 of Software Licensing, we bundled a new version of the EDD_SL_Plugin_Updater
that contained support for plugin icons in WordPress 4.9 or greater. The main reasons these icons would not show are:
- The latest version of the Updater class has not been included in your distributed software. Learn more on integrating the updater with your plugin.
- The product does not have a featured image.
- The product has not had the proper thumbnail sizes created. This would happen if the featured image was uploaded prior to Software Licensing supporting plugin icons. To fix this you can use WPCLI or the Regenerate Thumbnails plugin, which will contain the proper sizes for the icon.
Troubleshooting Update Issues
If you are seeing errors when attempting to update plugins and themes from your Software Licensing store here are a few things you can check, depending on what error is being reported.
Customize your Updater
As more and more plugin developers use the Software Licensing extension to deliver updates to their products, there is a risk of a “conflict” if another plugin includes a different version of the EDD_SL_Plugin_Updater class than you are packaging with your plugin. You can rename this class to something unique to your plugin, so that it avoids conflicts. For instance, if my plugin name is “My Custom Ads”, I could rename `EDD_SL_Plugin_Updater` to `MCA_Plugin_Updater` and change any references to it.
SSL Errors
There are many errors that can be caused by SSL connectivity issues, the following are commonly seen with Software Licensing.
SSL: certificate subject name does not match
This error means that the SSL certificate installed on your site does not match your primary domain name. This can typically happen in shared hosting environments and the most commonly solution is to request a dedicated IP address from your hosting provider. If your hosting provider does not support dedicated IP addresses, then you will need to work with your hosting provider to configure a proper SSL chain that matches your primary domain, instead of a shared wildcard SSL certificate.
SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
This SSL Handshake error occurs when the OpenSSL version on the server of the site requesting the update is outdated and does not support the SSL Protocols that the store delivering the update requires. There are two ways to resolve this issue. The ideal solution is to have the site requesting the update verify that their OpenSSL software us up to date for their platform. OpenSSL is a server software that facilitates the communication over the HTTPS protocol. If this is not a possible solution, you can work with your hosting provider or server administrator to configure your web-server to accept these outdated SSL versions, but this is not ideal as it allows less secure connections to your server.
cURL error 35: SSL connect error
This specific error with Software Licensing delivering updates is usually seen when using Cloudflare’s Flexible SSL option. This option causes a chain issue with some cURL versions that exist on the client server requesting the update. There are a couple ways to fix this from the server side (without having to request the client to update their cURL version). The first is to upgrade to a paid Cloudflare SSL. The paid tier SSL Certificates from Cloudflare typically do not pose this problem. The other solut§ion is to purchase an SSL Certificate from a 3rd party and install it directly on your server.
Download failed. SSL: no alternative certificate subject name matches target host name
An error occurred while updating Resurrect: Download failed. SSL: certificate subject name '*.example.com' does not match target host name 'anotherexample.com'
This occurs when the customer’s site has an old version of either OpenSSL or cURL. The two sites then can’t communicate securely and the update fails.
The only fix is for the site with the older version of the software on their server to update to the latest versions.
Download failed. SSL peer certificate or SSH remote key was not OK
If your customers are seeing this error when updating their products, you will need to contact your web host to let them know that your SSL certificate is improperly configured:
Download failed. Service Unavailable
You’ll see this error when you are attempting to update a plugin or theme on a site that also hosts this plugin or theme. Due to the way that Software Licensing integrates with the WordPress Update API, it is not currently possible to update your own themes or plugins from the site that sells them. When WordPress installs an update, it temporarily puts your site into maintenance mode, and during that process your site cannot install its own update. To update a plugin or theme from a site that also sells it, you’ll need to manually install the update.
Download failed. Unauthorized / Too many redirects
This error occurs when updating your plugin or theme to a new version. When uploading your new version, if you add a new file with your new version and then delete the previous file row, as opposed to replacing the current version, it’s possible for this error to occur. Currently we are aware of this bug and are working to resolve it, however the simple solution in the meantime is to click the ‘Update’ button a 2nd time, to rewrite the file keys, or always replace the current file instead of adding your new files on a second file row.
Update Package Unavailable
When this error comes up, it typically means:
- There is an issue with the license activation on the customer’s site. There are few things to check if a customer reports this error. The first is that the domain they are trying to update has been activated for the license. You can determine this by going to Downloads → Licenses. You can then search for the license key the user is trying to update and click on ‘Manage Sites’ to be sure that the domain they are on is in the list. If it’s not, you can either add it yourself from the admin, or have the customer visit their License management page and activate it themselves.
- The other result is that a license is either expired or disabled. If this is the case the customer needs to either renew their license, or a site admin has disabled it manually.
Weird, long folder name after updater
This happens when the .zip file is created improperly. When creating the final .zip archive, it is important to zip the folder and its contents rather than just the contents of the folder.
The zip file structure should look something like this:
filename.zip
– product-name/
— file here
— another file here
In other words, the files must be in a folder and not at the top of the zip file. Repackage your file to include the folder name inside and that will fix it.
CloudFlare Integration
If you are using CloudFlare as a CDN, Caching Layer, or SSL provider, we recommend you configure CloudFlare to bypass cache for all URLs that contain the following string:
/edd-sl
This is the API endpoint for checking the license status and delivering update packages. If these endpoint URLs are cached it can cause issues with properly delivering updates to your customers.
PCLZIP_ERR_BAD_FORMAT
This error isn’t unique to the EDD Software Licensing platform but has a couple solutions that you might check. The first is that there is an adequate amount of disk space for the file to be downloaded and unpacked (assume you’ll need 2x the size of the .zip file in order to process the update). If your .zip file is 1MB you will need just over 2MB available to properly process an update. These numbers are not exactly 2x but it’s a good measure to start with.
The other thing to verify is that the .zip file is not corrupt. You can test this by transferring the .zip file to another computer (attached in an email, or via USB) and attempting to unpack it there as well. If it does not unpack on a different computer there is likely an issue with the creation of the .zip file on the original computer.
This error can also be caused by a plugin or a script that is throwing an error. When the Software Licensing API tries to create the zip package, the error is added to the zip file, breaking its structure. Normally this means your website has WP_DEBUG set to TRUE in the wp-config.php file. While it’s a good way to check for any errors, it’s best to have it set to FALSE on a live website. Alternatively, you can keep it enabled but log the errors to a file on your server, in the wp-contents/debug.log file. Do this by adding the following lines to the wp-config.php file:
define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_display', false );