Skip to content

Update Check

Check if a newer version of a product is available. Returns WordPress-compatible update information.

GET /v1/wp/update-check

Query Parameters

ParameterRequiredDescription
slugYesProduct slug
license_keyYesLicense key for download access
versionYesCurrently installed version

Response

json
{
  "name": "My Plugin",
  "slug": "my-plugin",
  "version": "2.0.0",
  "new_version": "2.0.0",
  "url": "https://example.com/readme",
  "package": "https://api.packedge.dev/v1/download/rel_xxx?license_key=KEY",
  "tested": "6.4",
  "requires": "5.0",
  "requires_php": "7.4",
  "icons": {
    "1x": "https://example.com/icon-128.png",
    "2x": "https://example.com/icon-256.png"
  },
  "banners": {
    "low": "https://example.com/banner-772x250.png",
    "high": "https://example.com/banner-1544x500.png"
  },
  "sections": {
    "description": "Plugin description",
    "changelog": "## 2.0.0\n- New feature"
  }
}

The package field (download URL) is only included if the license key is valid and active.

Example

bash
curl "https://api.packedge.dev/v1/wp/update-check?slug=my-plugin&license_key=MYPLUGIN-XXXX-XXXX-XXXX-XXXX&version=1.0.0"

Caching

  • Product info and latest release data cached in KV for 5 minutes
  • Cache key: wp-update:{slug}

WordPress Integration

Hook into the WordPress update system:

php
add_filter('pre_set_site_transient_update_plugins', function($transient) {
    $license_key = get_option('my_plugin_license_key');
    $current_version = MY_PLUGIN_VERSION;

    $response = wp_remote_get(add_query_arg([
        'slug' => 'my-plugin',
        'license_key' => $license_key,
        'version' => $current_version,
    ], 'https://api.packedge.dev/v1/wp/update-check'));

    if (is_wp_error($response)) {
        return $transient;
    }

    $update = json_decode(wp_remote_retrieve_body($response));

    if (version_compare($current_version, $update->version, '<')) {
        $transient->response['my-plugin/my-plugin.php'] = (object) [
            'slug' => $update->slug,
            'new_version' => $update->version,
            'package' => $update->package,
            'icons' => (array) $update->icons,
        ];
    }

    return $transient;
});

See WordPress SDK for a simpler integration.