Version 2.2 - Product Validation Update

Complete License Management System

Professional WordPress plugin for selling and protecting your digital products

📚 Overview

NV License Manager একটি সম্পূর্ণ লাইসেন্স ম্যানেজমেন্ট সিস্টেম যা WordPress Plugin এবং Theme বিক্রয় ও সুরক্ষার জন্য ডিজাইন করা হয়েছে। এটি WooCommerce এর সাথে সম্পূর্ণভাবে integrated এবং automatic license generation, validation, এবং management প্রদান করে।

🎉 Version 2.2 Highlights Product slug validation যোগ করা হয়েছে যা নিশ্চিত করে যে প্রতিটি license শুধুমাত্র নির্দিষ্ট product এর জন্য কাজ করবে।

কেন NV License Manager?

  • Easy Setup: মাত্র 5 মিনিটে install এবং configure করা যায়
  • WooCommerce Integration: Automatic license generation on purchase
  • Product Protection: Secure API-based validation
  • Beautiful UI: Modern admin interface
  • Developer Friendly: Well-documented REST API

⚡ Key Features

🔐

Product Validation

License শুধুমাত্র সঠিক product এ কাজ করবে product slug এর মাধ্যমে

🛒

WooCommerce Ready

Automatic license generation যখন customer purchase complete করবে

🔄

Auto-Sync

Products automatically sync হয় license manager এ

🌐

Domain Locking

প্রতিটি license specific domain এ lock থাকে

📊

Analytics

License usage এবং activation track করুন

🔌

REST API

Powerful API endpoints validation এবং management এর জন্য

📦 Installation

Download Plugin

Download করুন nv-license-manager-v2.2.zip file

Upload to WordPress

WordPress Admin → Plugins → Add New → Upload Plugin

Activate Plugin

Plugin activate করুন। Database tables automatically তৈরি হবে

Configure Settings

License Manager → Settings থেকে API key copy করুন

✅ Success! Installation complete! এখন আপনি WooCommerce products create করতে পারেন এবং license enable করতে পারেন।

🚀 Quick Start (5 Minutes)

Step 1: Create WooCommerce Product

WooCommerce → Products → Add New

  • Product name এবং price set করুন
  • Scroll করে "License Product" checkbox টিক দিন
  • License duration select করুন (1 Month, 6 Months, 1 Year, Lifetime)
  • Publish করুন

Step 2: Copy Credentials

Configuration
API URL: https://api.safecommerce.net/wp-json/nv-license/v1/
API Key: [Your API Secret Key from Settings]
Product Slug: [Your product slug from Products page]

Step 3: Integrate License Class

Copy class-license-manager-ready-to-use.php to your plugin's includes/ folder এবং configure করুন:

PHP
private $api_url = 'https://api.safecommerce.net/wp-json/nv-license/v1/';
private $api_key = 'your-api-secret-key';
private $product_slug = 'your-product-slug';
private $prefix = 'your_plugin';

Step 4: Load in Main Plugin

PHP
// Load license manager
require_once plugin_dir_path(__FILE__) . 'includes/class-license-manager.php';

// Check if licensed
$license_manager = get_license_manager();

if ($license_manager->is_license_valid()) {
    // Load all features
    require_once 'includes/your-features.php';
} else {
    // Show activation notice
}
🎉 Done! আপনার plugin এখন license protected! Users এখন license activate করতে পারবে Settings → License থেকে।

🔌 API Documentation

Base URL

https://api.safecommerce.net/wp-json/nv-license/v1/

Authentication

সকল API requests এ X-API-Key header প্রয়োজন:

Headers
X-API-Key: your-secret-api-key
Content-Type: application/json

Endpoints

1. Validate License

POST /validate

License activate করে এবং domain register করে।

Request
{
  "license_key": "A1B2-C3D4-E5F6-G7H8",
  "domain": "example.com",
  "product_slug": "my-awesome-plugin"
}
Response (Success)
{
  "success": true,
  "message": "License validated and domain registered",
  "product_id": 123,
  "product_name": "My Awesome Plugin",
  "product_slug": "my-awesome-plugin",
  "domain": "example.com",
  "license_status": "active",
  "expires_at": "2025-12-31 23:59:59"
}

2. Check Status

POST /status

License এর current status check করে।

Request
{
  "license_key": "A1B2-C3D4-E5F6-G7H8"
}

3. Deactivate License

POST /deactivate

একটি domain থেকে license deactivate করে।

Request
{
  "license_key": "A1B2-C3D4-E5F6-G7H8",
  "domain": "example.com"
}

Error Codes

Code Status Description
missing_parameters 400 Required parameters missing
missing_product_slug 400 Product slug not provided
invalid_license 404 License key doesn't exist
product_mismatch 403 License not for this product
expired 403 License has expired
activation_limit_reached 403 Max activations exceeded

🔗 Product Integration

WordPress Plugin

আপনার plugin এ license system integrate করার complete example:

your-plugin.php
<?php
/**
 * Plugin Name: My Premium Plugin
 * Version: 1.0.0
 */

// Load license manager
require_once plugin_dir_path(__FILE__) . 'includes/class-license-manager.php';

class My_Premium_Plugin {
    
    private $license_manager;
    
    public function __construct() {
        $this->license_manager = get_license_manager();
        
        if ($this->is_licensed()) {
            $this->load_premium_features();
        } else {
            $this->show_license_notice();
        }
    }
    
    public function is_licensed() {
        return $this->license_manager->is_license_valid();
    }
    
    public function load_premium_features() {
        // Load all premium features
        require_once 'includes/premium-feature.php';
    }
    
    public function show_license_notice() {
        add_action('admin_notices', function() {
            echo '<div class="notice notice-warning">';
            echo '<p>Please activate your license.</p>';
            echo '</div>';
        });
    }
}

new My_Premium_Plugin();

WordPress Theme

Theme এর functions.php তে add করুন:

functions.php
<?php
// Load license manager
require_once get_template_directory() . '/includes/class-license-manager.php';

// Check function
function is_theme_licensed() {
    $license_manager = get_license_manager();
    return $license_manager->is_license_valid();
}

// Use in templates
if (is_theme_licensed()) {
    // Show premium features
} else {
    // Show basic features
}

💻 Code Examples

JavaScript Example

JavaScript
async function validateLicense(licenseKey, domain, productSlug) {
    const apiUrl = 'https://api.safecommerce.net/wp-json/nv-license/v1/validate';
    const apiKey = 'your-api-key';
    
    try {
        const response = await fetch(apiUrl, {
            method: 'POST',
            headers: {
                'X-API-Key': apiKey,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                license_key: licenseKey,
                domain: domain,
                product_slug: productSlug
            })
        });
        
        const data = await response.json();
        
        if (data.success) {
            console.log('License validated!');
            return data;
        } else {
            console.error('Validation failed:', data.message);
            return null;
        }
    } catch (error) {
        console.error('API Error:', error);
        return null;
    }
}

cURL Example

Bash
curl -X POST https://api.safecommerce.net/wp-json/nv-license/v1/validate \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "license_key": "A1B2-C3D4-E5F6-G7H8",
    "domain": "example.com",
    "product_slug": "my-awesome-plugin"
  }'

🔧 Troubleshooting

Common Issues

⚠️ "Connection Failed"

Check your API URL and API key. Make sure they are correct.

⚠️ "Product Mismatch"

Verify that you're using the correct product slug. Check License Manager → Products.

⚠️ "License Not Activating"

Enable WP_DEBUG and check wp-content/debug.log for detailed error messages.

Debug Mode

Enable debug mode in wp-config.php:

PHP
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

❓ Frequently Asked Questions

কিভাবে product slug পাবো?

License Manager → Products page থেকে product slug দেখতে পারবেন।

Multiple products এ একই license key কাজ করবে?

না, প্রতিটি license শুধুমাত্র নির্দিষ্ট product এর জন্য কাজ করবে product slug এর মাধ্যমে।

কতগুলো domains এ activate করা যাবে?

এটি max_activations setting এর উপর নির্ভর করে। Default 1 domain।

License expire হলে কি হবে?

API expired error return করবে এবং features disable হয়ে যাবে। User কে renewal করতে হবে।

API down থাকলে কি হবে?

Grace period implement করা আছে। 7 দিন পর্যন্ত features কাজ করবে।

💡 More Questions? Check the complete documentation files or contact support.

📥 Download Files

সব files download করুন এবং আপনার project এ use করুন:

  • nv-license-manager-v2.2-with-product-validation.zip - Complete Plugin
  • class-license-manager-ready-to-use.php - Ready-to-use License Class
  • PRODUCT-PROTECTION-GUIDE.md - Detailed Integration Guide
  • QUICK-START-5-MINUTES.md - Fast Setup Guide
  • API-USAGE-WITH-PRODUCT.md - Complete API Documentation
Download Complete Package View on GitHub