Anmelden
Loslegen

Easy Digital Downloads Dokumentation

Dokumentation, Referenzmaterialien und Tutorials für Easy Digital Downloads 

Software Licensing API – Beispiel mit jQuery

Dieses Dokument ist eine Teilmenge des
Software Licensing API-Dokuments, das alle über die API verfügbaren Funktionen auflistet. Das Folgende ist Beispielcode, der zeigt, wie diese Funktionen mit jQuery implementiert werden.

Anfrage

var data = {
edd_action: 'check_license', // Valid actions are activate_license, deactivate_license, get_version, check_license
license: '',
item_id: encodeURIComponent(''),
url: 'domain.com' // If you Disable URL Checking, you do not need this entry
};

// The url to the site running Easy Digital Downloads w/ Software Licensing
var postUrl = 'https://example.com/';

var requestSettings = {
type: 'POST',
data: data,
dataType: 'jsonp'
};

var request = jQuery.ajax( postUrl, requestSettings );

request.always( function(response) {

var slData = jQuery.parseJSON( response.responseText );

if ( slData.success && slData.success == true ) {
// License check returned data
// Parse the request for the necessary action requested above
} else {
// License check did not return successfully
}

Antwort

Eine Antwort auf die obige Abfrage wäre ein JSON-Objekt, das ungefähr so aussehen würde:

{
	"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]"
}
Was this article helpful?

Verkaufen Sie noch heute!

Schließen Sie sich über 50.000 klugen Shop-Besitzern an und nutzen Sie die einfachste Methode, um digitale Produkte mit WordPress zu verkaufen.

Copyright © 2025 Sandhills Development, LLC

[universally_switcher]