はじめに LicenseChain

LicenseChain を数分で起動して実行できます。このガイドは、最初のライセンスを設定し、アプリケーションでライセンスの検証を開始するのに役立ちます。

🚀 クイックスタート

前提条件

  • のアカウント dashboard.licensechain.app
  • ダッシュボードからの API キー
  • 好みのプログラミング言語 SDK がインストールされている

ステップ 1: SDK を選択する

プログラミング言語の SDK を選択します。

Node.js
npm install licensechain-node-sdk
パイソン
pip install licensechain-python-sdk
JavaScript
npm install licensechain-js-sdk
行く
go get github.com/licensechain/LicenseChain-Go-SDK
ルビー
gem install licensechain_ruby_sdk
さび
cargo add licensechain

私たちのを参照してください 完全な SDK リスト 利用可能なすべての言語に対応します。

ステップ 2: API キーを取得する

  1. でサインアップしてください dashboard.licensechain.app
  2. 「設定」→「API キー」に移動します
  3. 新しい API キーを作成する
  4. API キーをコピーして安全に保存します

ステップ 3: SDK を初期化する

Node.js の例

import LicenseChain from 'licensechain-node-sdk';

const client = new LicenseChain({'{'}
  apiKey: 'your-api-key-here',
  baseUrl: 'https://api.licensechain.app'
{'}'});

// Verify a license
try {'{'}
  const license = await client.licenses.verify('LICENSE-KEY-HERE');
  console.log('License status:', license.status);
  console.log('License valid:', license.isValid);
{'}'} catch (error) {'{'}
  console.error('License validation failed:', error.message);
{'}'}

Python の例

from licensechain import Client

client = Client(
    api_key='your-api-key-here',
    base_url='https://api.licensechain.app'
)

# Verify a license
try:
    license = client.licenses.verify('LICENSE-KEY-HERE')
    print(f'License status: {'{'}license.status{'}'}')
    print(f'License valid: {'{'}license.is_valid{'}'}')
except Exception as e:
    print(f'License validation failed: {'{'}e{'}'}')

ステップ 4: API 経由で最初の製品とライセンスを作成する

本番環境と同等の API ファースト オンボーディングを使用します。

curl -X POST "https://api.licensechain.app/v1/products" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"{"}"name":"Starter","price":19.99,"currency":"USD"{"}"}'

次に、ライセンスを作成します POST /v1/apps/:appId/licenses そして確認してください POST /v1/licenses/verify.

ステップ 5: ライセンスを検証する

SDK を使用してアプリケーションのライセンスを検証します。

// Validate license on application startup
const isValid = await client.licenses.verify(userLicenseKey);

if (!isValid) {'{'}
  // Show error message
  console.error('Invalid license');
  return;
{'}'}

// Continue with application logic
console.log('License validated successfully');

📚 API エンドポイント

すべての SDK は次の場所で LicenseChain API に接続します。 https://api.licensechain.app/v1。 SDK は自動的に先頭に /v1 すべてのエンドポイントのプレフィックス。

方法 終点 説明

✅ 次のステップ