授权 API
授权激活、查询与设备管理
POST
/v1/licenses/activate激活授权
使用授权密钥在指定设备上激活软件授权。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
license_key | string | 是 | 授权密钥 |
device_id | string | 是 | 设备唯一标识(如硬件指纹) |
device_name | string | 否 | 设备名称,便于用户识别 |
请求示例
curl -X POST https://api.ipayxx.cn/v1/licenses/activate \
-H "Content-Type: application/json" \
-d '{
"license_key": "LIC-ABCD-EFGH-IJKL-MNOP",
"device_id": "hw_fingerprint_abc123",
"device_name": "MacBook Pro 16""
}'响应示例
{
"code": 0,
"message": "success",
"data": {
"license_key": "LIC-ABCD-EFGH-IJKL-MNOP",
"status": "activated",
"product_id": "prod_pro_license",
"device_id": "hw_fingerprint_abc123",
"device_name": "MacBook Pro 16\"",
"max_devices": 3,
"current_devices": 1,
"activated_at": "2026-03-08T10:10:00Z",
"expires_at": null
}
}GET
/v1/licenses/:license_key查询授权
查询授权密钥的详细信息,包括状态、已绑定设备等。
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
license_key | string | 授权密钥 |
请求示例
curl https://api.ipayxx.cn/v1/licenses/LIC-ABCD-EFGH-IJKL-MNOP \ -H "Authorization: Bearer sk_test_xxxxxxxxxxxx"
响应示例
{
"code": 0,
"message": "success",
"data": {
"license_key": "LIC-ABCD-EFGH-IJKL-MNOP",
"status": "activated",
"product_id": "prod_pro_license",
"order_no": "ORD20260308100001",
"max_devices": 3,
"current_devices": 1,
"devices": [
{
"device_id": "hw_fingerprint_abc123",
"device_name": "MacBook Pro 16\"",
"bound_at": "2026-03-08T10:10:00Z",
"last_seen_at": "2026-03-08T10:10:00Z"
}
],
"activated_at": "2026-03-08T10:10:00Z",
"expires_at": null,
"created_at": "2026-03-08T10:05:32Z"
}
}DELETE
/v1/licenses/:license_key/devices/:device_id移除设备
从授权中移除已绑定的设备,释放设备配额。
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
license_key | string | 授权密钥 |
device_id | string | 设备唯一标识 |
请求示例
curl -X DELETE https://api.ipayxx.cn/v1/licenses/LIC-ABCD-EFGH-IJKL-MNOP/devices/hw_fingerprint_abc123 \ -H "Authorization: Bearer sk_test_xxxxxxxxxxxx"
响应示例
{
"code": 0,
"message": "success",
"data": {
"license_key": "LIC-ABCD-EFGH-IJKL-MNOP",
"device_id": "hw_fingerprint_abc123",
"removed": true,
"current_devices": 0
}
}授权状态说明
| 状态 | 说明 |
|---|---|
not_activated | 未激活,授权密钥已生成但未在任何设备上激活 |
activated | 已激活,至少在一台设备上完成激活 |
expired | 已过期,订阅型授权到期 |
revoked | 已吊销,因退款或违规被强制停用 |
suspended | 已暂停,临时冻结 |