跳转到主要内容
POST
/
licenses
/
activate
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const response = await client.licenses.activate({ license_key: 'license_key', name: 'name' });

console.log(response.id);
{
  "business_id": "<string>",
  "created_at": "2024-01-01T00:00:00Z",
  "customer": {
    "customer_id": "<string>",
    "email": "<string>",
    "name": "<string>",
    "metadata": {},
    "phone_number": "<string>"
  },
  "id": "lki_123",
  "license_key_id": "lic_123",
  "name": "Production Server 1",
  "product": {
    "product_id": "<string>",
    "name": "<string>"
  }
}
无需 API 密钥:这是一个公共端点,不需要身份验证。您可以直接从客户端应用程序、桌面软件或 CLI 调用它,以激活许可证密钥,而无需暴露您的 API 凭据。

Body

application/json
license_key
string
required
name
string
required

Response

License key instance created

business_id
string
required

Business ID

created_at
string<date-time>
required

Creation timestamp

Example:

"2024-01-01T00:00:00Z"

customer
object
required

Limited customer details associated with the license key.

id
string
required

License key instance ID

Example:

"lki_123"

license_key_id
string
required

Associated license key ID

Example:

"lic_123"

name
string
required

Instance name

Example:

"Production Server 1"

product
object
required

Related product info. Present if the license key is tied to a product.