Skip to main content
License keysはLicense Key entitlement typeです。必要な有効化制限、有効期限、手順を設定してLicense Key entitlementを一度作成し、任意のproductに紐付けます。Dodo Paymentsが、購入またはsubscription seatごとにkeyを自動生成して配信します。

License Keysとは?

License keysは、productへのアクセスを許可する一意のtokenです。次の用途に適しています。
  • ソフトウェアライセンス: Desktop apps、plugins、CLIs
  • seat単位の制御: userまたはdeviceごとのactivationを制限
  • デジタル商品: downloads、updates、premium featuresへのアクセスを制御
Dodo Paymentsでは、license keysはEntitlements systemで管理されます。つまり、各keyのlifecycle(creation、expiry、revocation、regrant)は、他のdeliverablesと同じpaymentおよびsubscription eventsによって制御されます。

License Key Entitlementを作成する

1

Open Entitlements

Dodo Payments dashboardでEntitlementsに移動し、**+**をクリックして新しいentitlementを作成します。
2

Choose License Key

integrationとしてLicense Keyを選択します。発行される各keyの動作を設定します。
  • Activations Limit: keyごとの同時activationの最大数(例: 1ユーザーの場合は1、team licensesの場合は5、無制限の場合は空欄)。
  • Duration: 発行後にkeyが有効である期間(例: 30日、1年)。subscription-issued keysでは空欄にします。subscriptionがactiveである限り、keysは有効です。
  • Activation Instructions: keyとともにemailで送信される、customer向けの手順。例: Paste the key in Settings → LicenseまたはRun: mycli activate <key>
名前、fulfillment mode、license length、activations limit、activation messageを含む新しいLicense Key entitlementフォーム
3

Save the entitlement

保存します。entitlementを任意のproductに紐付けられるようになりました。

Productsに紐付ける

productを開き、Advanced Settings → Entitlements & Creditsを展開して、License Key entitlementを選択します。1つのproductで、同じ購入に対して他のentitlements(Discord access、file downloads、GitHub repo accessなど)とともにlicense keyを配信できます。
License Keyが選択されたproduct entitlementsパネル

Selecting the License Key entitlement in the product entitlements panel.


Keysの発行方法

Keyの発行は標準のgrant lifecycleに従います。

Quantityの動作

  • Subscription productsはseatごとに1つのkeyを発行します(subscriptions.quantity)。
  • One-time productsはcart line itemごとに1つのkeyを発行します(product_cart.quantity)。
  • Manual API grantsは正確に1つのkeyを発行します。

Fulfillment mode

すべてのLicense Key entitlementには、keyを誰が提供するかを制御するfulfillment_modeがあります。
  • auto(デフォルト):Dodo Payments は、支払いまたはサブスクリプションの時点でキーを自動的に生成し、メールで送信します。これは上記で説明した動作であり、fulfillment_mode が省略された場合に適用されます。
  • manual:購入によってキーなしの Pending grant が作成され、各キーの値は自分で指定します。詳しくは、以下の Manual Fulfillment を参照してください。

Manual Fulfillment

デフォルトでは、Dodo Payments は顧客が支払った時点でライセンスキーを生成し、メールで送信します。manual fulfillment を使用すると、キーを自分で指定できます。購入によってキーなしの Pending grant が作成され、通知が届き、キーの値を送信するまで待機します。キーが自社システム、サードパーティベンダー、または事前印刷されたコードの有限プールから提供される場合に使用してください。
step-by-stepの構築方法を確認しますか?productの作成からkeyの配信までの一連の手順については、Manual License Key Fulfillment Integration Guideを参照してください。

使用するタイミング

ほとんどのソフトウェアライセンスでは、auto fulfillmentが適切なdefaultです。Dodo Payments自体でkeyをmintできない場合は、manual fulfillmentを選択します。
  • Bring-your-own-keys: keyはapplication、desktop product、または自社のlicense serverによって生成されます。
  • Third-party vendors: upstream providerが発行したkeys(game key、API credential、partner platform)を再販売します。
  • Finite inventory: 事前に割り当てたpoolからcodeを1つずつ配布します。
  • Human review: accessを提供する前に購入を審査します。

Manual fulfillmentを有効にする

License Key entitlementのintegration configでfulfillment_mode: "manual"を設定します。
fulfillment_modeはbackward compatibleです。このsettingが存在する前に作成されたentitlementsにはfulfillment_modeがなく、autoとして動作し続けます。manualへの切り替えは、変更後に作成されたgrantにのみ影響します。すでに配信されたkeysは変更されません。

Fulfillment待ちのgrantsを見つける

顧客が manual-mode の商品を購入すると、キーなしで Pending status の grant が作成され、integration_type: "license_key" および status: "Pending" を含む entitlement_grant.created webhook が発生します。この webhook に応答するか、integration_type および status フィルターを指定して List Customer Grants endpoint をポーリングできます。

Keyを配信する

Fulfill License Key Grant endpoint でキーを送信します。grant は Delivered に移行し、顧客にはキーが自動的に送信されます。これは auto fulfillment の場合に受信するメールと同じものです。
cURL
activations_limitexpires_atは任意で、省略時はentitlement configにフォールバックします。各grantは1回のみfulfillできます。すでにfulfilledのgrantを再試行すると、2つ目のkeyを発行せず409を返します。
keyを自分でemail送信する必要はありません。grantがfulfilledになると自動的に配信されます。これはPOST /license_keys経由でimporting keysする場合とは異なり、後者では意図的にcustomerへ通知されません。

Activation、Validation、Deactivation

activation/validation/deactivation API endpointsはpublicで、API keyを必要としません。desktop software、CLIs、またはbrowser-based clientsから直接使用して、runtimeでkeysを検証します。
Public Endpoints: activate、deactivate、validate license endpointsはpublicで、API keyを必要としません。API credentialsを公開せず、client applicationsから直接呼び出してください。

Licenseをactivateする

Licenseをvalidateする

Activation instanceをdeactivateする


Keysを管理する

dashboardからLicense Key entitlementを開くと、delivery date、activation count、revoke actionとともに、すべてのgrant(customer keyごとに1行)を確認できます。各grant detailには、基盤となるlicense key、expiry、使用済みactivations、activations limitが表示されます。 grantsをprogrammaticallyにlistすることもできます。

API経由で既存のLicense Keysをimportする

すでに別のsystemにlicense keysがありますか?Create License Key APIを使用して、Dodo Paymentsにimportします。これによりcustomerに影響を与えず既存keysを移行できます。再発行することなく、同じkey stringsに対して引き続きactivate、validate、deactivateできます。
API経由で作成または更新されたlicense keysは、customerへのemail notificationsを発生させません。importしたkeyについてcustomerに通知する必要がある場合は、applicationで別途処理してください。

Sourceによるkeysの違い

license-key レコードの source フィールドを使用すると、照合または監査の際に、移行された inventory および手動で fulfillment されたキーと、通常どおり発行されたキーを区別できます。List Grants で返される grant の license_key オブジェクトから読み取ってください。従来の GET /license_keys endpoint は deprecated です。
Polar.shまたはLemon Squeezyから移行しますか?dodo-migrate CLIは、products、customers、discounts、license keysのbulk importsを1つのcommandで自動化し、external IDsをDodo IDsに自動的にmapします。

Return URLのLicense Keys

customerがLicense Key entitlementを含むproductの購入を完了すると、生成されたkeyが自動的にreturn_urlにquery parameterとして追加されます。これにより、追加のAPI callなしでsuccess pageにkeyをすぐ表示できます。
購入によって複数のkeys(quantity > 1)が生成される場合、comma-separatedになります。
subscriptionsでは、payment_idの代わりにsubscription_idが使用されます。
return pageでlicense_key parameterをparseしてkeyをすぐ表示すると、購入後のexperienceが向上します。

API Management

Activation、deactivation、validationはpublicです。API keyは必要ありません。

Activate License

license keyのactivation instanceを作成または記録します。

Deactivate License

以前のactivationをrevokeしてcapacityを解放します。

Validate License

accessを許可する前にauthenticity、status、constraintsを確認します。
個別のlicense key recordsをcreate、list、retrieve、updateします。既存keysのimportやusage detailsの取得に使用します。
GET /license_keysGET /license_keys/{id}PATCH /license_keys/{id} は deprecated です。読み取りには entitlement grant endpoint(List GrantsList Customer Grants)を使用してください。既存のキーの import には POST /license_keys を引き続き使用できます。

Create License Key

新しい license key を作成するか、既存のキーを import します。

List License Keys

ステータスと使用状況の詳細を含むすべてのキーを参照します。

Get License Key

特定のキーとその metadata を取得します。

Update License Key

有効期限、activation limit、またはキーの有効化・無効化を変更します。
License Key entitlement 自体を管理します。activation limit、期間、手順を設定できます。

Create Entitlement

License Key entitlement を作成します。

Update Entitlement

entitlement の設定を更新します。

List Grants

entitlement に対して発行されたキーを一覧表示します。

Revoke Grant

顧客のキーを手動で revoke します。

Webhooks

License-key の配信および revoke により、4 つの entitlement_grant.* webhook events が発生します。grant payload には、キー、有効期限、使用済み activation 数、limit が入力された license_key オブジェクトが含まれます。 従来の license_key.* events(license_key.created)は、基盤となる license-key レコードの lifecycle に対して引き続き発生します。詳細は License Key webhook payload page を参照してください。
新しい integration では、license_key.created ではなく entitlement_grant.delivered を listen してください。entitlement event は、license key だけでなく、product 上のすべての integration に対する配信が完了したことを示します。

Legacy License Keys

従来の license_key_enabled flag で作成された product は、License Key entitlement に 自動的に移行 されています。移行は透過的に行われます。既存顧客のキーは変更なしで引き続き機能し、public の /licenses/activate/licenses/validate/licenses/deactivate endpoint も引き続き機能します。また、/license_keys/* API endpoint は同じ key store に対して引き続き読み書きを行います。独立した License Keys dashboard section は、発行されたすべてのキーの flat list として引き続き利用でき、監査や検索に役立ちます。新しい設定(activation limit、期間、手順の変更)は、Entitlements で移行済みの License Key entitlement を編集して行ってください。

Best Practices

  • activation limit を明確にする: 適切なデフォルト値(single-user app では 1、team license では 3~5)を選択し、文書化してください。
  • 正確な activation instructions を提供する: 顧客はメールからこれらを貼り付けるため、正確な path と command によって support ticket を減らせます。
  • server-side でキーを validate する: network-connected product では、activation をローカルに cache するのではなく、/licenses/validate を使用して validate してください。
  • revoke には webhooks を使用する: 顧客が cancel または refund したときに in-app feature を直ちに無効化できるよう、entitlement_grant.revoked を listen してください。
  • subscription と one-time でテストする: License Key の動作はこの 2 つで微妙に異なるため、live にする前に両方をテストしてください。
最終更新日 2026年8月21日