An open API service indexing awesome lists of open source software.

https://github.com/firassaidi/keevault-lm-wc-integration

Keevault - Software License Manager and Telemetry Data Collection - WooCommerce Integration
https://github.com/firassaidi/keevault-lm-wc-integration

api integration laravel plugin woocommerce wordpress

Last synced: 3 months ago
JSON representation

Keevault - Software License Manager and Telemetry Data Collection - WooCommerce Integration

Awesome Lists containing this project

README

          

# Keevault License Manager - WooCommerce Integration

Keevault License Manager for WooCommerce connects your store to Keevault so license keys can be assigned automatically after purchase. It maps WooCommerce products and variations to Keevault products, requests license keys from Keevault, stores them in WordPress, and shows them in both wp-admin and the customer account area.

## Requirements

- WordPress
- WooCommerce
- [Keevault - Software License Manager and Telemetry Data Collection](https://codecanyon.net/item/keevault-license-manager-and-telemetry-data-collection/51172292)

## Feature Overview

### License key assignment

- Assigns license keys when an order reaches `processing` or `completed`.
- Also attempts assignment on `payment_complete` and `thankyou` to reduce delays.
- Supports both API modes:
- `random-assign-license-keys` (live/immediate response)
- `random-assign-license-keys-queued` (queued response + webhook completion)
- Prevents duplicate assignment per order item by tracking queue and existing assigned quantity.
- Stores assigned keys in a dedicated database table linked to order, item, user, and product.

### Queued webhook flow

- Handles queued key callbacks through:
- `/?keevault-webhook=YOUR_KEY`
- Validates webhook key against the configured key.
- On successful Keevault response code, stores returned keys for the order.

### Auto revocation

- Watches WooCommerce status transitions.
- Can auto-revoke on:
- `cancelled`
- `refunded`
- Sends revocation calls to Keevault (`update-license-key`, status `blocked`).
- Updates local key status to `blocked` and writes WooCommerce order notes with success/failure counts.

### Admin experience

- Adds **Keevault** admin menu with:
- **License Keys** page
- **Settings** page
- License Keys page includes:
- Search by key
- User filter
- Start/end date filters
- Pagination
- Product and variation mapping fields use SelectWoo searchable dropdowns (no manual ID typing).
- Bulk mapping tools:
- Auto-map unmapped products/variations by exact name match against Keevault products.
- Clear all existing Keevault mappings in one action.
- Order edit screen displays stored keys for that order.
- Order edit screen includes an optional **Resend License Keys Email** action.
- Settings page includes tabs:
- API
- Cache
- Webhooks
- API tab includes a live API connection test (products + stock endpoint diagnostics via AJAX).

### Customer experience

- Adds a `License Keys` item to My Account navigation.
- My Account license keys list is paginated and shows order, key, limits, validity, status, and date.
- Order details page includes an AJAX-rendered license key block that retries until keys are available.
- Pending key generation is shown with a clear waiting message while queued keys are being processed.
- Customer emails include a license key section:
- HTML emails render a table template.
- Plain-text emails render a text list.

### Stock integration (mapped products only)

- Keevault stock applies only to mapped products/variations. Unmapped products keep normal WooCommerce behavior.
- Supports two stock strategies:
- **Sync WooCommerce stock**: writes mapped Keevault quantities/status/backorders into stored WooCommerce product stock.
- **Virtual live stock mode**: applies Keevault stock at runtime through WooCommerce stock hooks.
- Runtime/cart protections include:
- Add-to-cart quantity validation
- Cart quantity update validation
- Cart-wide revalidation
- Quantity input/variation max handling
- Generator-enabled Keevault products are treated as purchasable with unlimited quantity.
- Non-generator mapped products are limited by Keevault available quantity.
- Updates local stock cache immediately after order placement for non-generator mapped products (including Store API checkout path).

### Caching

- Products cache (`get-all-products`) with configurable TTL.
- Stock cache (`get-available-license-keys-stock`) with configurable TTL.
- Stock cache is stored in both:
- option metadata
- dedicated table for per-product rows and timestamps
- Manual cache controls:
- Clear products cache
- Clear stock cache
- Clear all caches
- Relevant setting changes automatically clear caches and reset stock sync hash.

### Templates

- Admin templates are plugin-internal only.
- Frontend templates support theme overrides at:
- `wp-content/themes/your-theme/keevault-lm-wc-integration/frontend/`
- Frontend template files:
- `my-account-license-keys.php`
- `order-license-key-details.php`
- `email-license-keys.php`

## Installation

1. Upload the plugin to `/wp-content/plugins/`.
2. Activate **Keevault License Manager - WooCommerce Integration**.
3. Open **Keevault > Settings**.
4. Configure API credentials and endpoint mode.
5. If using queued assignment mode, configure a webhook key.
6. Map WooCommerce products/variations to Keevault products.

## Configuration

### API tab

- `API Key`
- `API URL`
- `Select License Keys Endpoint`:
- Live (`random-assign-license-keys`)
- Queued (`random-assign-license-keys-queued`)
- `Test API Connection` button for endpoint diagnostics.
- Auto-revocation toggles:
- Revoke on cancelled
- Revoke on refunded

### Cache tab

- Enable/disable products cache.
- Products cache duration (seconds).
- Enable/disable stock cache.
- Stock cache duration (seconds).
- Enable/disable WooCommerce stock sync mode.
- Enable/disable virtual live stock mode.
- Cache action buttons to clear products/stock/all caches.

### Webhooks tab

- `Webhook Key` for queued callbacks.
- Callback format:
- `/?keevault-webhook=YOUR_KEY`

### Product mapping

- Simple products: map in Product Data (General).
- Variations: map per variation.
- Mapping fields use searchable SelectWoo options loaded from Keevault products API.

## Data Storage

Plugin tables:

- `{prefix}keevault_license_keys`
- `{prefix}keevault_orders_queues`
- `{prefix}keevault_stock_cache`

Main plugin options include API credentials, endpoint mode, webhook key, cache flags/durations, stock mode flags, and revocation toggles.

## Automated Tests

- Run the lightweight test suite from plugin root:
- `php tests/run.php`
- Coverage includes:
- Installer activation/upgrade smoke checks
- Assignment behavior for queued and live endpoint modes
- Generator stock unlimited-quantity behavior
- Revocation flow (remote block + local status update)

## Activation and Upgrade Behavior

On activation:

- Registers `license-keys` rewrite endpoint.
- Flushes rewrite rules.
- Creates/updates plugin database tables.

On plugin load:

- Runs schema upgrade checks.
- Resets stock cache if upgrading from older schema versions that require it.

## Release Notes

### 1.0.2

- Generator-enabled mapped products now allow unlimited purchase quantity in cart/add-to-cart validation.
- Legacy dashboard template wrapper removed; templates are consolidated under `templates/`.
- Added structured operational logging for API/webhook/stock/revocation events.
- Added bulk mapping tools and order-level resend license email action in admin.
- Added clearer pending-license-key messaging for admin and customers.
- Added automated test coverage and installer activation/upgrade smoke checks.