The WooCommerce API Manager PHP Library for Plugins and Themes is a PHP Library that can be dropped into a plugin and theme for API Key authentication and software updates with the WooCommerce API Manager.
Using the PHP Library
The WooCommerce API Manager PHP Library for Plugins and Themes with the code needed to connect a plugin or theme to the PHP Library after it has been dropped into the plugin or theme. The second argument in the code block example below is for the product_id. If the product_id is left blank the customer enters the product_id, if the product_id is hard coded, then the customer will not need to enter the product_id.
Once the product is activated, a notice is displayed for the customer to activate the plugin or theme.
On the activation screen, if the product_id was hard coded then the customer only needs to enter the API Key. If this is a variable product variation, each version of the software will require a separate file with the correctly hard coded product_id matching the customer’s product purchase. This is why not hard coding the product_id is the preferred method for variable product variations as shown in the next example.
On the activation screen, if the product_id was not hard coded then the customer needs to enter both the API Key and the product_id. This is the preferred method for variable product variations.
After the plugin is activated, the number of activations remaining is displayed.
For custom menus the admin message may not work, so in version 2.9 of the library an Activation info section was added that can display remote store and local server errors to assist in troubleshooting.
The Activation info section can also display live activations information whether the API Key is activated or not.
Orders that have API Key activations will display a key in the orders list.
On the order screen, the activations will be listed.
When an update is available the update details will be displayed. Plugins and themes can be updated automatically just like any other plugins and themes.
Click on the view version details link will display the details you have provided and configured just like any other plugins and themes.
After the plugin is deactivated, the activations remaining is displayed.
Auto-updates for both plugins and themes as introduced in WordPress 5.5, and with Parent and Child themes individually even when one is not the active theme, but has an activated API Key.
Using Postman for Testing
A preconfigured Postman .json file collection template is included to make it easy to test the API functions. Server URL, and keys/values, will need to be modified specific to your product and server.
Software Update File Hosting
The file used for software updates can be hosted on the local server, Amazon S3, or from any remote URL. The file download URL is wrapped in a secure URL that expires after the expire time you set.