Skip to content
Thrive Tech Services
Thrive Tech Services
HomeServicesProductsDocsEnterpriseContactAbout
LoginRegister

Integration Guide

This guide walks you through integrating ThriveTech Platform into your software product, from SDK setup to production deployment.


SDK Installation

JavaScript/TypeScript

bash
npm install @thrivetech/sdk
typescript
import { ThriveTech } from '@thrivetech/sdk';
const client = new ThriveTech({
apiKey: process.env.THRIVETECH_API_KEY,
environment: 'production' // or 'sandbox'
});

Python

bash
pip install thrivetech-sdk
python
from thrivetech import ThriveTech
client = ThriveTech(
api_key=os.environ['THRIVETECH_API_KEY'],
environment='production'
)

.NET (C#)

bash
dotnet add package ThriveTech.SDK
csharp
using ThriveTech;
var client = new ThriveTechClient(new ThriveTechConfig {
ApiKey = Environment.GetEnvironmentVariable("THRIVETECH_API_KEY"),
Environment = ThriveTechEnvironment.Production
});

Java

xml
<dependency>
<groupId>com.thrivetech</groupId>
<artifactId>thrivetech-sdk</artifactId>
<version>1.0.0</version>
</dependency>
java
ThriveTechClient client = ThriveTechClient.builder()
.apiKey(System.getenv("THRIVETECH_API_KEY"))
.environment(Environment.PRODUCTION)
.build();

Core Workflows

1. License Activation

typescript
async function activateLicense(licenseKey: string) {
const result = await client.licenses.activate({
license_key: licenseKey,
device_fingerprint: await generateDeviceFingerprint(),
product_id: 'YOUR_PRODUCT_ID',
metadata: { os: process.platform, app_version: '1.0.0' }
});
if (result.success) {
await storeActivationToken(result.data.activation_token);
return { success: true, features: result.data.entitlements };
}
}

2. License Validation

Periodic validation to ensure licenses remain valid:

typescript
async function validateLicense(): Promise<boolean> {
const activationToken = await getStoredActivationToken();
if (!activationToken) return false;
try {
const result = await client.licenses.validate({
activation_token: activationToken,
device_fingerprint: await generateDeviceFingerprint()
});
return result.data.valid;
} catch (error) {
if (error.code === 'NETWORK_ERROR') {
return await checkCachedValidation(); // Offline grace period
}
return false;
}
}

3. Feature Entitlements

Control feature access based on license:

typescript
const result = await client.entitlements.get({ activation_token: token });
if (result.data.features.advanced_export) {
showAdvancedExportButton();
}
const maxUsers = result.data.features['limit:max_users'] ?? 0;

4. Subscription Webhooks

Handle subscription lifecycle events on your server:

typescript
app.post('/webhooks/thrivetech', async (req, res) => {
const signature = req.headers['x-thrivetech-signature'];
if (!verifyWebhookSignature(req.body, signature)) {
return res.status(401).send('Invalid signature');
}
switch (req.body.type) {
case 'subscription.renewed':
await updateUserSubscription(req.body.data.customer_id, 'active');
break;
case 'subscription.cancelled':
await updateUserSubscription(req.body.data.customer_id, 'cancelled');
break;
case 'payment.failed':
await notifyPaymentFailure(req.body.data.customer_id);
break;
}
res.status(200).send('OK');
});

Webhook Setup

  1. Go to Dashboard → Settings → Webhooks
  2. Click Add Endpoint
  3. Enter your HTTPS endpoint URL
  4. Select events to receive
  5. Copy the signing secret

Webhook Events

EventDescription
license.activatedLicense activated on a device
license.deactivatedLicense deactivated
license.expiredLicense reached expiration
subscription.createdNew subscription started
subscription.renewedSubscription renewed
subscription.cancelledSubscription cancelled
payment.succeededPayment processed successfully
payment.failedPayment failed
device.addedNew device registered
device.removedDevice removed from license

Security Best Practices

  1. Protect API keys — Use environment variables, never hardcode
  2. Validate webhook signatures — Always verify before processing
  3. Use HTTPS everywhere — All API calls and webhook endpoints
  4. Secure token storage — Use OS keychain/credential storage, not plain text files
  5. Certificate pinning — For mobile apps, pin the ThriveTech API certificate

Testing

Use the sandbox environment for development:

typescript
const client = new ThriveTech({
apiKey: process.env.THRIVETECH_SANDBOX_KEY,
environment: 'sandbox'
});

Sandbox Base URL: https://sandbox.api.thrivetechservice.com

Test License Keys

Key PatternBehavior
TEST-VALID-XXXX-XXXXAlways activates successfully
TEST-EXPIRED-XXXX-XXXXReturns LICENSE_EXPIRED
TEST-SUSPENDED-XXXX-XXXXReturns LICENSE_SUSPENDED
TEST-LIMIT-XXXX-XXXXReturns DEVICE_LIMIT_REACHED

Troubleshooting

IssueSolution
"Invalid API Key"Ensure correct environment (live vs sandbox)
Webhook not receivedCheck firewall rules, verify endpoint accessible
Device fingerprint changesUse more stable hardware identifiers
Activation failsCheck device limit, verify license key format
AuthenticationGuides

Was this helpful?