Client SDK Integration

SDK Location

Bundle the client SDK in each licensed product:

example-plugin/
  example-plugin.php
  vendor/
    awecommerce-client/
      bootstrap.php
  .awecommerce/
    product.json

Theme:

example-theme/
  style.css
  functions.php
  vendor/
    awecommerce-client/
      bootstrap.php
  .awecommerce/
    product.json

Plugin Registration

<?php
/**
 * Plugin Name: Example Plugin
 * Version: 1.2.3
 * Update URI: https://store.example.com/awecommerce/example-plugin
 */

define('EXAMPLE_PLUGIN_VERSION', '1.2.3');

require_once __DIR__ . '/vendor/awecommerce-client/bootstrap.php';

add_action('plugins_loaded', function () {
    AweCommerce_Client::register([
        'product_name' => 'Example Plugin',
        'product_slug' => 'example-plugin',
        'software_kind' => 'wordpress_plugin',
        'version' => EXAMPLE_PLUGIN_VERSION,
        'plugin_file' => __FILE__,
        'store_hostname' => 'store.example.com',
        'api_base_url' => 'https://store.example.com/wp-json/awecommerce/v1',
        'update_uri' => 'https://store.example.com/awecommerce/example-plugin',
        'channel' => 'stable',
        'sdk_version' => '1.0.0',
        'contract_version' => 1,
    ]);
});

Theme Registration

require_once __DIR__ . '/vendor/awecommerce-client/bootstrap.php';

add_action('after_setup_theme', function () {
    AweCommerce_Client::register([
        'product_name' => 'Example Theme',
        'product_slug' => 'example-theme',
        'software_kind' => 'wordpress_theme',
        'version' => wp_get_theme()->get('Version'),
        'theme_stylesheet' => get_stylesheet(),
        'store_hostname' => 'store.example.com',
        'api_base_url' => 'https://store.example.com/wp-json/awecommerce/v1',
        'update_uri' => 'https://store.example.com/awecommerce/example-theme',
        'channel' => 'stable',
    ]);
});

Passive Metadata

File:

.awecommerce/product.json

Example:

{
  "schema": 1,
  "store_hostname": "store.example.com",
  "api_base_url": "https://store.example.com/wp-json/awecommerce/v1",
  "update_uri": "https://store.example.com/awecommerce/example-plugin",
  "product_slug": "example-plugin",
  "software_kind": "wordpress_plugin",
  "channel": "stable",
  "manifest_url": "https://store.example.com/wp-content/uploads/awecommerce/manifests/example-plugin/stable/manifest.json",
  "main_file": "example-plugin/example-plugin.php",
  "theme_stylesheet": ""
}

Do not place license keys, bootstrap tokens, package tokens, site secrets, customer emails, or domains in passive metadata.

Latest Bundled Client Behavior

The bundled client:

  • Registers a license menu page for each product.
  • Shows admin notices for inactive or bad-standing licenses.
  • Processes activation and deactivation forms.
  • Stores activation state under awc_client_state_{slug}.
  • Schedules a daily status check.
  • Provides an admin AJAX handler for manual status refresh.
  • Stores refreshed license_status, runtime_behavior, chargeback_runtime_behavior, and manifest_url.
  • Registers native update hooks for plugins and themes.
  • Handles same-host package download loopback by dispatching the package request internally through WordPress REST.

License Page Payload Options

AweCommerce_Client::register([
    'product_name' => 'Example Plugin',
    'product_slug' => 'example-plugin',
    'menu_parent' => 'options-general.php',
]);

If menu_parent is empty, the client creates a top-level menu page. If set, it creates a submenu page.

Runtime Behavior Display

The client maps runtime behavior values to labels:

continue_with_notice => Continue with Notice
continue_silently    => Continue Silently
read_only            => Read Only
hard_disable         => Hard Disable
deny_runtime_checks  => Deny Runtime Check
deny                 => Deny Runtime Check

SSL Verification Filter

Use only in local development:

add_filter('awc_client_sslverify', function (bool $verify, ?string $url = null): bool {
    if (is_string($url) && str_contains($url, '.test')) {
        return false;
    }

    return $verify;
}, 10, 2);

Do not disable SSL verification in production.

Was this documentation helpful?