Title: Integrating Plugin
Last modified: August 24, 2016

---

# Integrating Plugin

 *  Resolved [hesusko](https://wordpress.org/support/users/hesusko/)
 * (@hesusko)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/integrating-plugin/)
 * Hi.
 * I would like to know how to integrate your plugin to create license for my own
   plugin. I can’t find the link for the sample plugin you gave.
 * “software-license-manager/client-side/sample-plugin”
 * Thanks,
    John
 * [https://wordpress.org/plugins/software-license-manager/](https://wordpress.org/plugins/software-license-manager/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972727)
 * The sample plugin code is included inside this plugin. Open the zip file of this
   plugin and you will find a folder called “client-side-examples”. the sample plugin
   is in that folder.
 *  [Mauro Gonçalves](https://wordpress.org/support/users/nocaonet/)
 * (@nocaonet)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972768)
 * save. I managed to communication. However I’m having trouble with that activate
   the theme functions. I am integrating the theme funciotion.php, however if on
   or off does not change anything. What should I put in the subject line and in
   which file gets better. I get the usual information in managed panel. Only the
   customer who does not know which lines or codes should change. can you help me?
 * Follow my code?
 * _[huge file removed – see:
    [http://codex.wordpress.org/Forum\_Welcome#Posting\_Large\_Excerpt\_of\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Large_Excerpt_of_Code)]
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972769)
 * **[@nocaonet](https://wordpress.org/support/users/nocaonet/)** – please **start
   your own thread** and use a pastebin to post that much code as per:
    [http://codex.wordpress.org/Forum_Welcome#Posting_Large_Excerpt_of_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Large_Excerpt_of_Code)
 *  [Mauro Gonçalves](https://wordpress.org/support/users/nocaonet/)
 * (@nocaonet)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972770)
 * ok! Sorry.
 * follows the code in postbin;
 * [http://pastebin.com/70FVvLx8](http://pastebin.com/70FVvLx8)
 * follows the code in pastebin. is the function.php. I do not know if it is even
   integrate the codes for the license.
 *  [dragonfly67](https://wordpress.org/support/users/dragonfly67/)
 * (@dragonfly67)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972789)
 * Hi, I’m not shure if this helps. I also didn’t manage to create a license through
   the API using the “Secret Key for License Creation” code. With this code I always
   got the message “wrong secret API Code” or so. So I tried the other one (“Secret
   Key for License Verification Requests”) and it worked for license creation and
   activations. May be this helps.
 * But there’s still something I don’t understand is, that the API allows to create
   a new license for the same attributes like First Name, Last Name, Email, Company
   and so on multiple times. Is this meant to be like that. Shouldn’t it be limited
   to one license code for an email address or so?
    Or am I missing something here?
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972790)
 * [@dragonfly67](https://wordpress.org/support/users/dragonfly67/), I have updated
   the plugin so it will now correctly use the value from the “Secret Key for License
   Creation” field for license creation API check.
 * It lets you create as many license entries as you need for a user. Imagine having
   5 products and one of your customers purchasing all those products. You will 
   need 5 different licenses for this user. Each product has a license. Now, you
   can limit the usage of that license key to 1 or many usage.
 *  [dragonfly67](https://wordpress.org/support/users/dragonfly67/)
 * (@dragonfly67)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972791)
 * [@mra13](https://wordpress.org/support/users/mra13/), thank you very much. I 
   just tested with the “The License Creation API secret key” and it works perfectly.
   Still I do not understand which field the product should be. As an example, I
   can create the same license with identical field values over and over again and
   it creates me every time a new license key for the same “unique Transaction ID”
   even when the “maximum allowed Domains” is set to 1. I’d like to use it for creating
   license keys for a software. And therefore a user should not be able to create
   a new license key over and over again.
 * I probably do not understand it correctly. I thought the uniqueness of a User/
   Product combination would be something like email and Transaction id. But somehow
   its not.
 * I can run this sample code over and over again and every time it creates a new
   license for the same user/product:
 *     ```
       $create_license = array(
       'slm_action' => 'slm_create_new',                // or slm_activate, slm_create_new
       'secret_key' => 'xxxxxxxxxxxx.xxxxxxxx',         // The License Creation API secret key
       'first_name' => 'John',
       'last_name' => 'Doe',
       'email' => 'john.doe@mailprovider.com',
       'company_name' => 'Testuser for Prod1',
       'txn_id' => 'PROD1',
       'max_allowed_domains' => '1',
       'date_created' =>date("Y-m-d"),
       'date_expiry' =>'2016-01-01',
       );
   
       print_r($create_license);echo '</br>';
   
       // Send query to the license manager server
       $response = wp_remote_get(add_query_arg($create_license, 'http://www.mywebsite.com'), array('timeout' => 20, 'sslverify' => false));
   
       print_r($response);echo '</br>';
   
       // Check for error in the response
       if (is_wp_error($response)){
       echo "Unexpected Error! The query returned with an error.";
       }
   
       // License data.
       $license_data = json_decode(wp_remote_retrieve_body($response));
   
       echo 'License Data:</br></br>';
       print_r($license_data);
       ```
   
 * Since I am quite new to WP I didn’t figure out how to use the above php-code 
   to be called from outside WP and still using WP-APIs.
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972793)
 * Add whatever restriction you want to add for your licenses to your code (that
   creates the license).
 * This is a plugin that will be used by developers and different developer will
   have completely different needs. It is best to handle the specific restrictions
   in the custom code rather than in the plugin. For example, I need to be able 
   to create many many license keys with the same details for ONE client.
 *  [Rashmi Sonawane](https://wordpress.org/support/users/rashmibright/)
 * (@rashmibright)
 * [11 years ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972804)
 * Hello,
    I am new to Theme development, I have developed a simple theme and want
   to use Software Licence Manager plugin to licence my WordPress Theme.
 * I have copied the code given in the sample plugin, changed the “YOUR_SPECIAL_SECRET_KEY”
   with the “The License Activation or Deactivation API secret key” from the Integration
   help page. Also changed the url and item reference. I added the complete code
   in my theme’s functions.php
    But when I activate the theme in another domain 
   for testing nothing happens[It does not ask for the licence]. Even if I go to
   the Licence page and enter the Licence number [which I manually generated] it
   gives the following error:
 *     ```
       object(WP_Error)#340 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(29) "A valid URL was not provided." } } ["error_data"]=> array(0) { } }
       Licence data is Null
       ```
   
 * I checked and copied the url from the Integration Help page.
 * Please Help, Thanks in advance !!!
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [11 years ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972805)
 * Looks like your request is missing the URL value. Construct the URL value (that
   we were going to send off), then manually enter that URL in the browser to make
   sure it is a valid value.
 *  [Alba](https://wordpress.org/support/users/mpujic/)
 * (@mpujic)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972824)
 * I would like to share a single WP installation to run the Software License Manager(
   SLM) and a plugin of mine. The URL root (e.g. [http://my.domain.com](http://my.domain.com))
   is used by my plugin. Can I assign a different path to the SLM e.g. [http://my.domain.com/licenses](http://my.domain.com/licenses)?
   If so, how?
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972826)
 * You can install SLM in any WP Install. So if you have a WP install in the following
   location then you should be able to get what you want by installing SLM there:
 * [http://my.domain.com/licenses](http://my.domain.com/licenses)

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Integrating Plugin’ is closed to new replies.

 * ![](https://ps.w.org/software-license-manager/assets/icon-128x128.png?rev=1135848)
 * [Software License Manager](https://wordpress.org/plugins/software-license-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/software-license-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/software-license-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/software-license-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/software-license-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/software-license-manager/reviews/)

 * 12 replies
 * 7 participants
 * Last reply from: [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/integrating-plugin/#post-5972826)
 * Status: resolved