ログイン
始める

Easy Digital Downloads ドキュメント

Easy Digital Downloads のドキュメント、参考資料、チュートリアル

ソフトウェアライセンスAPI – jQueryを使用した例

このドキュメントは、APIで利用可能なすべての機能が記載されているソフトウェアライセンスAPIドキュメントのサブセットです。以下は、jQueryを使用してこれらの機能を実装する方法を示すサンプルコードです。

リクエスト

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
}

レスポンス

上記のクエリへの応答は、次のようなJSONオブジェクトになります。

{
	"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]"
}
この記事は役に立ちましたか?

今日から販売を開始しましょう!

50,000人以上のスマートなストアオーナーに参加して、WordPressでデジタル製品を販売する最も簡単な方法を使い始めましょう。

Copyright © 2025 Sandhills Development, LLC

[universally_switcher]