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 ThriveTechclient = 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
- Go to Dashboard → Settings → Webhooks
- Click Add Endpoint
- Enter your HTTPS endpoint URL
- Select events to receive
- Copy the signing secret
Webhook Events
| Event | Description |
|---|---|
license.activated | License activated on a device |
license.deactivated | License deactivated |
license.expired | License reached expiration |
subscription.created | New subscription started |
subscription.renewed | Subscription renewed |
subscription.cancelled | Subscription cancelled |
payment.succeeded | Payment processed successfully |
payment.failed | Payment failed |
device.added | New device registered |
device.removed | Device removed from license |
Security Best Practices
- Protect API keys — Use environment variables, never hardcode
- Validate webhook signatures — Always verify before processing
- Use HTTPS everywhere — All API calls and webhook endpoints
- Secure token storage — Use OS keychain/credential storage, not plain text files
- 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 Pattern | Behavior |
|---|---|
TEST-VALID-XXXX-XXXX | Always activates successfully |
TEST-EXPIRED-XXXX-XXXX | Returns LICENSE_EXPIRED |
TEST-SUSPENDED-XXXX-XXXX | Returns LICENSE_SUSPENDED |
TEST-LIMIT-XXXX-XXXX | Returns DEVICE_LIMIT_REACHED |
Troubleshooting
| Issue | Solution |
|---|---|
| "Invalid API Key" | Ensure correct environment (live vs sandbox) |
| Webhook not received | Check firewall rules, verify endpoint accessible |
| Device fingerprint changes | Use more stable hardware identifiers |
| Activation fails | Check device limit, verify license key format |
Was this helpful?
