API 参考
LicenseChain 核心 API 基本 URL 为 https://api.licensechain.app/v1。身份验证使用Authorization: Bearer <user-jwt-or-app-api-key>。
工作流程优先的引导图
产品API
可以通过API(列出、创建、读取、PUT/PATCH更新、删除)完全管理产品,包括与Dashboard卖家产品UI相同的字段。使用PATCH进行部分更新。
创建产品请求
{
"name": "Pro Monthly",
"description": "Recurring access to premium feature set",
"price": 49.99,
"currency": "USD",
"active": true,
"successUrl": "https://merchant.example.com/pay/success",
"cancelUrl": "https://merchant.example.com/pay/cancel",
"helpUrl": "https://merchant.example.com/help",
"supportUrl": "https://merchant.example.com/support",
"termsUrl": "https://merchant.example.com/terms",
"privacyUrl": "https://merchant.example.com/privacy",
"refundUrl": "https://merchant.example.com/refund",
"productType": "subscription",
"billingType": "recurring",
"interval": "month",
"stripePriceIdRecurring": "price_1AbCdEfGhIjKlMn",
"stripeTaxEnabled": true,
"stripeIdentityRequired": false,
"cryptoPaymentsEnabled": true,
"hideEmail": false,
"autoRedirect": false
} 产品反应
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user_123",
"name": "Pro Monthly",
"description": "Recurring access to premium feature set",
"price": 49.99,
"currency": "USD",
"active": true,
"successUrl": "https://merchant.example.com/pay/success",
"cancelUrl": "https://merchant.example.com/pay/cancel",
"helpUrl": "https://merchant.example.com/help",
"supportUrl": "https://merchant.example.com/support",
"termsUrl": "https://merchant.example.com/terms",
"privacyUrl": "https://merchant.example.com/privacy",
"refundUrl": "https://merchant.example.com/refund",
"productType": "subscription",
"billingType": "recurring",
"interval": "month",
"stripePriceIdRecurring": "price_1AbCdEfGhIjKlMn",
"stripeTaxEnabled": true,
"stripeIdentityRequired": false,
"cryptoPaymentsEnabled": true,
"hideEmail": false,
"autoRedirect": false,
"licenseEmails": [
"licenses-a@merchant.example.com",
"licenses-b@merchant.example.com"
],
"sendLicenseToCustomer": true,
"callbackSecret": "base64url_or_base64_secret_from_product_record",
"createdAt": "2026-05-11T07:00:00.000Z",
"updatedAt": "2026-05-11T07:00:00.000Z"
} 交易状态API
使用 POST /transaction/status 表示一笔交易,使用 POST /transactions 表示批量详细信息。
状态请求
{
"transaction": "pi_3RxExample123"
} 状态响应
{
"status": 200,
"transactionStatus": "paid",
"transactionStatusReason": "Transaction successfully completed",
"info": "",
"transaction": {
"transactionId": "pi_3RxExample123",
"transactionStatus": "paid",
"statusReason": "Transaction successfully completed",
"licenseId": "lic_abc123",
"productId": "prod_8c9a1d74",
"amount": 49.99,
"currency": "USD",
"email": "buyer@example.com",
"timestamp": "2026-05-11T07:01:00.000Z",
"paymentProvider": "stripe"
}
} 许可证验证和JWT
验证请求
{
"key": "LC-XXXXXX-XXXXXX-XXXXXX",
"hwuid": "optional-device-id"
} 验证响应(使用可选的许可证令牌)
{
"valid": true,
"status": "ACTIVE",
"expiresAt": "2025-12-31T23:59:59Z",
"email": "user@example.com",
"verificationType": "custom",
"license_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImxpY2Vuc2VjaGFpbi0xIn0....signature",
"license_token_expires_at": "2024-01-01T01:00:00.000Z",
"license_jwks_uri": "https://api.licensechain.app/v1/licenses/jwks"
}