You've already forked wc-licensed-product
122 lines
3.1 KiB
Markdown
122 lines
3.1 KiB
Markdown
|
|
# WC Licensed Product
|
||
|
|
|
||
|
|
A WooCommerce plugin to sell software products using license keys with domain-based validation.
|
||
|
|
|
||
|
|
## Description
|
||
|
|
|
||
|
|
WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, enabling you to sell software with automatically generated license keys. Licenses are bound to specific domains and can be validated through a REST API.
|
||
|
|
|
||
|
|
## Features
|
||
|
|
|
||
|
|
- **Licensed Product Type**: New WooCommerce product type for software sales
|
||
|
|
- **Automatic License Generation**: License keys generated on order completion
|
||
|
|
- **Domain Binding**: Licenses are bound to customer-specified domains
|
||
|
|
- **REST API**: Public endpoints for license validation and management
|
||
|
|
- **Customer Account**: Customers can view their licenses in My Account
|
||
|
|
- **Admin Management**: Full CRUD interface for license management
|
||
|
|
- **Version Binding**: Optional binding to major software versions
|
||
|
|
- **Expiration Support**: Set license validity periods or lifetime licenses
|
||
|
|
|
||
|
|
## Requirements
|
||
|
|
|
||
|
|
- WordPress 6.0 or higher
|
||
|
|
- WooCommerce 10.0 or higher
|
||
|
|
- PHP 8.3 or higher
|
||
|
|
|
||
|
|
## Installation
|
||
|
|
|
||
|
|
1. Upload the `wc-licensed-product` folder to `/wp-content/plugins/`
|
||
|
|
2. Activate the plugin through the 'Plugins' menu in WordPress
|
||
|
|
3. The plugin will create necessary database tables on activation
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### Creating a Licensed Product
|
||
|
|
|
||
|
|
1. Go to Products > Add New
|
||
|
|
2. Select "Licensed Product" from the product type dropdown
|
||
|
|
3. Configure the product price in the General tab
|
||
|
|
4. Set license options in the "License Settings" tab:
|
||
|
|
- **Max Activations**: Number of domains allowed per license
|
||
|
|
- **License Validity**: Days until expiration (empty = lifetime)
|
||
|
|
- **Bind to Major Version**: Lock license to current major version
|
||
|
|
- **Current Version**: Your software's current version
|
||
|
|
|
||
|
|
### Customer Checkout
|
||
|
|
|
||
|
|
When a customer purchases a licensed product, they must enter the domain where they will use the license during checkout.
|
||
|
|
|
||
|
|
### Viewing Licenses
|
||
|
|
|
||
|
|
- **Customers**: My Account > Licenses
|
||
|
|
- **Administrators**: WooCommerce > Licenses
|
||
|
|
|
||
|
|
## REST API
|
||
|
|
|
||
|
|
### Validate License
|
||
|
|
|
||
|
|
```http
|
||
|
|
POST /wp-json/wc-licensed-product/v1/validate
|
||
|
|
Content-Type: application/json
|
||
|
|
|
||
|
|
{
|
||
|
|
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||
|
|
"domain": "example.com"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### Check Status
|
||
|
|
|
||
|
|
```http
|
||
|
|
POST /wp-json/wc-licensed-product/v1/status
|
||
|
|
Content-Type: application/json
|
||
|
|
|
||
|
|
{
|
||
|
|
"license_key": "XXXX-XXXX-XXXX-XXXX"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### Activate License
|
||
|
|
|
||
|
|
```http
|
||
|
|
POST /wp-json/wc-licensed-product/v1/activate
|
||
|
|
Content-Type: application/json
|
||
|
|
|
||
|
|
{
|
||
|
|
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||
|
|
"domain": "newdomain.com"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### Deactivate License
|
||
|
|
|
||
|
|
```http
|
||
|
|
POST /wp-json/wc-licensed-product/v1/deactivate
|
||
|
|
Content-Type: application/json
|
||
|
|
|
||
|
|
{
|
||
|
|
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||
|
|
"domain": "example.com"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## License Statuses
|
||
|
|
|
||
|
|
- **Active**: License is valid and usable
|
||
|
|
- **Inactive**: License has been deactivated
|
||
|
|
- **Expired**: License validity period has ended
|
||
|
|
- **Revoked**: License has been manually revoked by admin
|
||
|
|
|
||
|
|
## Support
|
||
|
|
|
||
|
|
For issues and feature requests, please visit:
|
||
|
|
<https://src.bundespruefstelle.ch/magdev/wc-licensed-product/issues>
|
||
|
|
|
||
|
|
## Author
|
||
|
|
|
||
|
|
Marco Graetsch
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
GPL-2.0-or-later
|