ログイン
始める

Easy Digital Downloads ドキュメント

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

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

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

リクエスト

using System;
using System.IO;
using System.Net;
using System.Text;

namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create ("https://yoursite.com/");


// Set the Method property of the request to POST.
request.Method = "POST";


// Create POST data and convert it to a byte array. Do not include the URL if you do URL verification in the EDD SL settings
string postData = "edd_action=check_license&license=&item_id=&url=";
byte[] byteArray = Encoding.UTF8.GetBytes (postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream ();
dataStream.Write (byteArray, 0, byteArray.Length);
dataStream.Close ();


// Get the response.
WebResponse response = request.GetResponse ();
dataStream = response.GetResponseStream ();
StreamReader reader = new StreamReader (dataStream);


// Read the content. This is the response from the Software Licensing API
string responseFromServer = reader.ReadToEnd ();


// Display the content
Console.WriteLine (responseFromServer);


// Clean up the streams.
reader.Close ();
dataStream.Close ();
response.Close ();
}
}
}

レスポンス

上記のクエリに対する応答は、次のような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]