Sellcodes Licensing API


The Sellcodes Licensing API provides a complete solution for managing the activation and de-activation of software products, based on your clients’ license keys which get automatically generated after purchase.

For example, you can: 

  • Remotely activate or de-activate license keys
  • Check if license keys are valid (and not expired)
  • Retrieve information about latest version of the software

You can also manage the license keys directly from your Sellcodes dashboard: 


Implementation

There are four API request types available:

  • activate_license          - Used to remotely activate a license key
  • check_license              - Used to remotely check if a license key is activated, valid, and not expired
  • deactivate_license      - Used to remotely de-activate a license key
  • get_version                  - Used to remotely retrieve the latest version information for a product

Each of the methods below works in the same way: https://api.sellcodes.com/v2/licenses/ will act as the API end point. All requests to the API are done as POST requests:

The request requires three parameters:

  • product_id - You’ll find this in the “seller link” at the end, e.g. for  https://sellcodes.com/jJPUX40f it is: "jJPUX40f"
  • license_key - This is the license key you are performing an action for.
  • baseurl - This is the site URL on which the Sellcodes offer is used (i.e. typically the client site)


The response for this request will be a JSON object:

1)  LICENSE KEY ACTIVATION:

    URL: https://api.sellcodes.com/v2/licenses/activate_license
   
    Method: POST
    
    Parameters: product_id, license_key, baseurl

  a) If the license has been successfully activated:

     HTTP STATUS CODE: 200

    RESPONSE:
    {
            "success": true,
            "message": "",
            "License_key_valid": true,
            "Activation_ok": true,
           "Activation_count": "1",
           "Maximum_activations": "1",
           "Product_name": "Sellcodes sample wordpress plugin",
           "Username": "Sam",
           "Purchase_date": 1511782193,
           "Expiry_date": "Unlimited",
           "Refunded": false
  }

b) If the license is invalid and failed to activate ( Due to license expiry or license key disabled by seller):

HTTP STATUS CODE: 400
RESPONSE:
{
           "success": true,
           "message": "",
           "License_key_valid": false
}


c)  If using an invalid license key (using a key not created by Sellcodes or license key of another Sellcodes offer):

HTTP STATUS CODE: 400

{
           "success": false,
           "message": "Invalid or missing license key "
}


d) If using an invalid product id:

HTTP STATUS CODE: 400

RESPONSE:
{
           "success": false,
           "license": "invalid",
           "item_name": "",
           "message": "Invalid or missing Product Id,  "
}


e)  If license key is being activated on maximum number of allowed activations per license:

 HTTP STATUS CODE: 200


{
           "success": true,
           "message": "",
           "License_key_valid": true,
           "Activation_ok": false,
           "Activation_count": "1",
           "Maximum_activations": "1",
           "Product_name": "Sellcodes sample wordpress plugin",
           "Username": "Sam",
           "Purchase_date": 1519117810,
           "Expiry_date": "Unlimited",
           "Refunded": false
}



2)  LICENSE KEY CHECK:


 URL: https://api.sellcodes.com/v2/licenses/check_license
 
 Method: POST   

 Parameters: product_id, license_key, baseurl

 If the license is active on given url:
 
 HTTP STATUS CODE: 200

RESPONSE:

{

        "success": true,

         "license": "valid",

         "item_name": "Sellcodes sample wordpress plugin",

         "message": "License is active",

         "Purchase_date": "2018-02-20 02:10:10",

         "expires": "Unlimited",

         "slug": "sellcodes-sample-wordpress-plugin",

        "customer_name": "Sam",

        "customer_email": "[email protected]",

        "license_limit": "1",

        "site_count": "1",

        "is_wordpress_product": "1",

        "offering_automatic_updates": "1",

        "activations_left": 0

}


   b) If license is inactive on given url:

  HTTP STATUS CODE: 200

 RESPONSE:
{
           "success": false,
           "license": "site_inactive",
           "item_name": "Sellcodes sample wordpress plugin",
           "message": "License is not active for the given site",
           "Purchase_date": "2018-02-20 02:10:10", 
          "expires": "Unlimited",
          "slug": "sellcodes-sample-wordpress-plugin",
          "customer_name": "sam",
          "customer_email": "[email protected]",
          "license_limit": "1",
          "site_count": "0",
          "is_wordpress_product": "1",
          "offering_automatic_updates": "1",
          "activations_left": 1
}


c)   If license key is being activated on maximum number of allowed activations per license:

HTTP STATUS CODE: 200

RESPONSE:
{
           "success": false,
           "license": "no_activations_left",
           "item_name": "Sellcodes sample wordpress plugin",
           "message": "License activation counts reached to max activation counts",
           "expires": "Unlimited",
           "slug": "sellcodes-sample-wordpress-plugin",
           "customer_name": "sam",
           "customer_email": "[email protected]",
           "license_limit": "1",
           "site_count": "1",
           "is_wordpress_product": "1",
           "offering_automatic_updates": "1",
           "activations_left": 0
}

d) If using an invalid license key (using a key not created by Sellcodes or license key of another Sellcodes offer):

HTTP STATUS CODE: 400

RESPONSE:
{
           "success": false,
           "license": "invalid",
           "item_name": "",
           "message": " Invalid or missing License Key, "
}

e) If using an invalid product id:

HTTP STATUS CODE: 400

RESPONSE:
{
           "success": false,
           "license": "invalid",
           "item_name": "",
           "message": "Invalid or missing Product Id,  "
}

3)  LICENSE KEY DEACTIVATION:


 URL: https://api.sellcodes.com/v2/licenses/deactivate_license
 
 Method: POST   

 Parameters: product_id, license_key, baseurl

   a) If the license has been successfully deactivated:

      HTTP STATUS CODE: 200

      RESPONSE:
 {
           "success": true,
           "license": "deactivated",
           "item_name": "Sellcodes sample wordpress plugin",
           "expires": "Unlimited",
           "customer_name": "sam",
           "customer_email": "[email protected]"
}

   b)  If license is already inactive on given url:

    HTTP STATUS CODE: 200

   RESPONSE:
{
           "success": false,
           "license": "site_inactive",
           "item_name": "Sellcodes sample wordpress plugin",
           "message": "License is not active for the given site",
           "expires": "Unlimited",
           "slug": "sellcodes-sample-wordpress-plugin",
           "customer_name": "sam",
           "customer_email": "[email protected]",
           "license_limit": "1",
           "site_count": "0",
           "activations_left": 1
}


4)  GET PRODUCT’S VERSION UPDATES: 

If your product is WordPress theme or plugin and you are offering automatic updates, you can use this api:

URL: https://api.sellcodes.com/v2/licenses/get_version
 
Method: POST   

Parameters: product_id, license_key, baseurl

{

    "name": "Sellcodes sample wordpress plugin",

    "tags": [

        "licensing",

        "sellcodes",

        "referral"

    ],

    "requires_at_least": "3.0",

    "tested_up_to": "4.9.4",

    "stable_tag": "1.0",

    "contributors": [

        "sellcodes"

    ],

    "donate_link": null,

    "short_description": "License: GPLv2 \nLicense URI: http://www.gnu.org/licenses/gpl-2.0.html\n\nSellcodes sample plugin",

    "screenshots": [],

    "remaining_content": "Short Description\nIt is a sample plugin which shows how sellcodes licensing works",

    "upgrade_notice": [],

    "url": "https://sellcodes.com/api/v1/licenses/changelog?product_id=jJPUX40f&license_key=44f683a84163b3523afe57c2e008bc8r",

    "homepage": "https://sellcodes.com/Ultimatelysocial/sellcodes-sample-wordpress-plugin",

    "new_version": "1.0",

    "last_updated": "1 hour ago",

    "stable_version": "1.0",

    "expires": "Unlimited",

    "slug": "sellcodes-sample-wordpress-plugin",

    "package": "https://sellcodes.com/push-file?file=cFduM2gvWThQUktvbm5MR3ZGZzRuQkgvemVxRTg2bE5SUUdhSVZiVmZwQUxWYVRnWVFrK2c2N0dXMEs3RVlZRm5ETHJrekNhNU4yRVFkRm95RlhWTVdubGFVR1JYbFNxMm80OXVsbzBmLzA9",

    "download_link": "https://sellcodes.com/push-file?file=cFduM2gvWThQUktvbm5MR3ZGZzRuQkgvemVxRTg2bE5SUUdhSVZiVmZwQUxWYVRnWVFrK2c2N0dXMEs3RVlZRm5ETHJrekNhNU4yRVFkRm95RlhWTVdubGFVR1JYbFNxMm80OXVsbzBmLzA9",

    "sections": "a:4:{s:11:\"description\";s:108:\"License: GPLv2 \nLicense URI: http://www.gnu.org/licenses/gpl-2.0.html\nSellcodes sample plugin\n\";s:12:\"installation\";s:169:\"Extract the zip file and drop the contents into the wp-content/plugins/ directory of your WordPress installation. Then activate the plugin from the plugins page.\n\";s:26:\"frequently_asked_questions\";s:349:\"I face fundamental issues (the plugin doesn't load etc.)\nPlease ensure that:\n- You're using the latest version of the plugin(s)\n- Your site is running on PHP 5.4 or above \n- You have CURL activated (should be activated by default)\nIf you're not familiar with those please contact your hosting company or server admin.\n\";s:9:\"changelog\";s:36:\"1.0\n* First release\n\";}"

}

Tell people about Sellcodes and get 20-40% on every resulting sale!