Software Licensing API - Example using Ruby

This document is a subset of the Software Licensing API document which lists all features available via the API. The following is example code showcasing how to implement those features with Ruby.


require 'net/http'

uri = URI('') # /edd-sl is the Softare Licensing API endpoint, this a required path
req =

edd_action = 'check_license' # Valid actions are activate_license, deactivate_license, get_version, check_license
license    = '<license key>'
item_name  = '<item name>'
url        = '' # If you have disabled URL chaecking in the settings, you do not need this

req.set_form_data('edd_action' => edd_action, 'license' => license, 'item_name' => item_name, 'url' => url)

res = Net::HTTP.start(uri.hostname, uri.port) do |http|

case res
when Net::HTTPSuccess, Net::HTTPRedirection
  # check res.code for a 200 response, and then the response from the Software Licenseing API
  # will be located in res.body as a string of JSON
  puts res.body


A response to the above query would be a JSON formatted string that would look something like this:

	"license": "valid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": ""