LiSense LAAS Integration Guide

Get started with license management in minutes

PHP License Verification

3-line integration with automatic caching:

valid) {
    die("License invalid: {$license->error}");
}
?>

Installation

  1. Download the client library:
curl -o laas-client.php https://api.lisensetech.com/download/client

Webhook Receiver

Node.js Integration

License Verification

// Install: npm install laas-client
const LAAS = require('laas-client');

async function validateLicense() {
    const license = await LAAS.validate(
        'LAAS-XXXX-XXXX', 
        123,
        { cacheTtl: 3600 }
    );
    
    if (!license.valid) {
        throw new Error(license.error);
    }
}

Webhook Setup

// server.js
const express = require('express');
const crypto = require('crypto');

const app = express();
app.use(express.json({ verify: verifySignature }));

function verifySignature(req, res, buf) {
    const signature = req.get('X-LAAS-Signature');
    const hmac = crypto.createHmac('sha256', process.env.WEBHOOK_SECRET);
    const digest = hmac.update(buf).digest('hex');
    
    if (!crypto.timingSafeEqual(
        Buffer.from(signature), 
        Buffer.from(digest)
    )) throw new Error('Invalid signature');
}

app.post('/webhooks', (req, res) => {
    console.log('Received event:', req.body.type);
    res.sendStatus(200);
});

app.listen(3000);

Package Setup

{
  "dependencies": {
    "express": "^4.18.2",
    "laas-client": "^1.0.0"
  },
  "scripts": {
    "start": "node server.js"
  }
}

Python Integration

License Verification

# Install: pip install laas-client
from laas import validate_license

license = validate_license(
    code="LAAS-XXXX-XXXX",
    app_id=123,
    cache_ttl=3600
)

if not license['valid']:
    raise Exception(license['error'])

Webhook Setup

# app.py
from flask import Flask, request, abort
import hmac
import hashlib

app = Flask(__name__)
WEBHOOK_SECRET = b'your_secret_here'

@app.route('/webhooks', methods=['POST'])
def handle_webhook():
    signature = request.headers.get('X-LAAS-Signature')
    if not verify_signature(request.data, signature):
        abort(401)
    
    event = request.json
    print(f"Received {event['type']} event")
    return '', 200

def verify_signature(payload, signature):
    digest = hmac.new(
        WEBHOOK_SECRET, 
        payload, 
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(digest, signature)

Requirements

# requirements.txt
Flask==2.3.2
laas-client==1.0.0
python-dotenv==1.0.0

Webhook Events

Supported Events

Event Type Payload Example
license_activated
{
  "type": "license_activated",
  "license_code": "LAAS-ABCD-1234",
  "app_id": 123,
  "expiry_date": "2024-12-31"
}
payment_processed
{
  "type": "payment_processed",
  "amount": 99.00,
  "currency": "USD",
  "license_code": "LAAS-ABCD-1234"
}

Security Best Practices

  • Always verify the X-LAAS-Signature header
  • Use HTTPS for your webhook endpoint
  • Respond within 2 seconds to prevent retries
  • Implement idempotency keys for duplicate events

🔍 API Sandbox

API Response
{
    "click_test_button": "Response will appear here"
}

📦 Client Libraries

PHP

PHP Client

Lightweight single-file client

Download (v1.2.0)
Requirements: PHP 7.4+
Node.js

Node.js SDK

Full TypeScript support

.tgz Package
npm install laas-client
Python

Python SDK

PyPI package available

Source Code
pip install laas-client

🎥 Video Tutorials

5-Minute Integration Guide

Learn how to add LiSense LAAS to your PHP application

Webhook Setup Walkthrough

Configure real-time notifications in Node.js

🚀 Quick Start

  1. Download the client library for your language
  2. Add the 3-line license check to your app
  3. Set up a webhook endpoint (optional)
  4. Test with the LiSense LAAS Sandbox