Before you can use the plugin, you must connect it to your Cloudflare R2 bucket.
This is the core functionality for both the Standard and Pro versions of the plugin.
courses/my-video-course.zip
or ebooks/my-guide.pdf
).Now, when a customer purchases this product, they will receive a secure, expiring download link that points directly to your file in R2, instead of a link to a file on your local server.
You can display secure content anywhere on your site using shortcodes.
csd_video
Embeds a secure, streaming video player.
videos/intro.mp4
)public
, loggedin
. (Default: public
)100%
)true
)muted=true
). (Default: false
)false
)false
)Example: csd_video key="training/module-1.mp4" access="loggedin" autoplay="true"
csd_download_link
Creates a download link for a specific product, only visible to users who have purchased it.
Download Now
)button csd-download-button
)Example: csd_download_link product_id="123" text="Download Your E-book"
csd_secure_asset
(Pro)The most powerful shortcode for delivering any type of asset with advanced controls.
download
, stream
, embed
. (Default: download
)public
, loggedin
, role:administrator
. (Default: public
)Download Asset
)csd_video
shortcode (width
, controls
, etc.).Example: csd_secure_asset key="blueprints/project-files.zip" type="download" access="loggedin" text="Download Project Files"
This section is for Pro users who want to sell and manage licenses for their own software (e.g., WordPress plugins, themes, desktop apps).
Before you can generate licenses, you must define your software products.
Navigate to CloudSecure Downloads -> Software Products.
Fill out the "Add New Software Product" form:
Product Name: The public name of your software (e.g., "My Awesome Plugin").
Product Slug: A unique, URL-friendly identifier (e.g., my-awesome-plugin
). This is what you will use in your API calls.
Version: The current version of your software (e.g., 1.0.0
).
Product Type: Helps you categorize your products (e.g., WordPress Plugin, Desktop Application).
Click Add Product.
You can generate licenses automatically through WooCommerce sales (see section 2) or manually.
Navigate to CloudSecure Downloads -> Software Licenses.
To create a license manually, fill out the "Generate New License" form.
From the "Existing Software Licenses" table, you can view all licenses, see their activation counts, status, and expiry dates.
This section is for developers using the REST API or integrating license checks into their own PHP-based products.
The REST API allows any external application to communicate with your WordPress site to validate, activate, and deactivate licenses.
Authentication: All API requests must include your API key in a header: X-API-Key: YOUR_API_KEY
. You can generate API keys in the plugin's settings.
Base URL: https://yoursite.com/wp-json/cloudsecure/v1/
Validate License
Endpoint: POST /validate-license
Description: Checks if a license key is valid for a given product, has not expired, and has available activations.
Body Parameters: product_slug
(string), license_key
(string), machine_id
(string, optional).
Activate License
Endpoint: POST /activate-license
Description: Activates a license for a specific machine, decrementing the available activation count.
Body Parameters: product_slug
(string), license_key
(string), machine_id
(string, required).
Deactivate License
Endpoint: POST /deactivate-license
Description: Deactivates a license from a specific machine, incrementing the available activation count.
Body Parameters: product_slug
(string), license_key
(string), machine_id
(string, required).
curl -X POST https://yoursite.com/wp-json/cloudsecure/v1/activate-license \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"product_slug": "my-awesome-plugin",
"license_key": "CSD-XXXX-XXXX-XXXX",
"machine_id": "UNIQUE-MACHINE-IDENTIFIER"
}'
If you are developing a WordPress plugin or theme, you can use this helper method for easy, secure license validation.
function my_plugin_check_license() {
// Check if CloudSecure Downloads Pro is active
if ( ! class_exists( 'CloudSecure_Downloads' ) ) {
// Handle case where licensing plugin is not active
return;
}
$product_slug = 'my-awesome-plugin';
$license_key = get_option( 'my_plugin_license_key' ); // Get key from user's options
$result = CloudSecure_Downloads::instance()->check_developer_license( $product_slug, $license_key );
if ( ! $result['valid'] ) {
// License is invalid, show a notice or disable features
add_action( 'admin_notices', function() use ( $result ) {
echo 'Your license for My Awesome Plugin is invalid. Reason: ' . esc_html( $result['message'] ) . '
';
});
}
}
add_action( 'admin_init', 'my_plugin_check_license' );
Q: My R2 Connection test is failing. What should I do?
A: 99% of the time, this is due to a typo. Carefully re-copy your Access Key ID, Secret Access Key, and Account ID from Cloudflare. Ensure there are no leading or trailing spaces.
Q: Can I use a private R2 bucket?
A: Yes, absolutely. The plugin uses your secure API credentials to generate temporary signed URLs, so your bucket does not need to be public. A private bucket is the recommended setup for maximum security.
Q: Why don't my download links show up on the Thank You page?
A: WooCommerce only grants download permissions when an order is marked as "Completed". If you are using a payment gateway that holds orders in "Processing," the links will not appear until the order is manually or automatically completed.