Accedi
Inizia

Documentazione di Easy Digital Downloads

Documentazione, Materiali di Riferimento e Tutorial per Easy Digital Downloads 

API per la gestione delle licenze software – Esempio con Ruby

Questo documento è un sottoinsieme del
documento API per la gestione delle licenze software, che elenca tutte le funzionalità disponibili tramite l'API. Di seguito è riportato un esempio di codice che illustra come implementare queste funzionalità con Ruby.

Richiesta

require 'net/http'

uri = URI('https://domain.com/')
req = Net::HTTP::Post.new(uri)

edd_action = 'check_license' # Valid actions are activate_license, deactivate_license, get_version, check_license
license = ''
item_id = '' # The ID of the product on your store
url = 'example.org' # 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_id' => item_id, 'url' => url)

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

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
else
res.value
end

Risposta

Una risposta alla query sopra sarebbe una stringa in formato JSON che assomiglierebbe a questo:

{
	"license": "valid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "[email protected]"
}
Questo articolo è stato utile?

Inizia a vendere oggi!

Unisciti a oltre 50.000 proprietari di negozi intelligenti e inizia a usare il modo più semplice per vendere prodotti digitali con WordPress.

Copyright © 2025 Sandhills Development, LLC

[universally_switcher]