Skip to content

WordPress Plugin Auto-Updates

Customers who install your WordPress plugin can receive update notifications and one-click updates directly inside the WordPress admin dashboard — without visiting your store or downloading files manually.

This works by connecting your plugin to ChargePanda's update API using the free Plugin Update Checker library. When a customer opens their WordPress dashboard, the library silently checks for a newer version. If one is available and their license is valid, WordPress shows the familiar "Update Available" banner and handles the download automatically.

Prerequisites

  • Your product must have at least one file version uploaded (Settings → Product → Files)
  • Each customer must have a valid, non-expired license key
  • Your plugin must include the Plugin Update Checker library (free, MIT licensed)

Integration

Step 1 — Add the library to your plugin

Download or Composer-install Plugin Update Checker and include it in your plugin:

php
// Via Composer (recommended)
// composer require yahnis-elsts/plugin-update-checker

// Or manually — drop the folder into your plugin directory
require_once plugin_dir_path(__FILE__) . 'vendor/plugin-update-checker/plugin-update-checker.php';

Step 2 — Register the update checker

Add the following snippet to your plugin's main file, replacing the placeholders with your own values:

php
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

add_action('init', function () {
    $licenseKey = get_option('your_plugin_license_key'); // where you store the customer's license

    if (empty($licenseKey)) {
        return; // no key saved yet — skip the check
    }

    PucFactory::buildUpdateChecker(
        add_query_arg([
            'license_key'     => $licenseKey,
            'slug'            => 'your-plugin-slug',   // must match your product slug in ChargePanda
            'current_version' => YOUR_PLUGIN_VERSION,  // your plugin's version constant
            'domain'          => home_url(),
        ], 'https://your-store.example.com/api/v1/update-check'),
        __FILE__,          // path to your plugin's main file
        'your-plugin-slug' // must match the slug above
    );
});

Plugin slug

The slug parameter must exactly match the URL slug of your product in ChargePanda. You can find it in the browser's address bar when viewing the product in your admin panel.

Step 3 — Store the license key

Your plugin needs a way to receive and save the customer's license key. A simple settings page or activation form is enough:

php
// Save
update_option('your_plugin_license_key', sanitize_text_field($_POST['license_key']));

// Read
$licenseKey = get_option('your_plugin_license_key', '');

Once saved, the update checker will use it automatically on every WordPress update check cycle (every 12 hours by default, plus immediately after plugin activation).

How updates are delivered

  1. WordPress triggers its background update check (or the customer visits Dashboard → Updates).
  2. Plugin Update Checker calls GET /api/v1/update-check with the customer's license key, plugin slug, installed version, and site domain.
  3. ChargePanda validates the license and returns the latest version information.
  4. If a newer version exists and the license is valid, WordPress shows "Update Available" on the Plugins screen.
  5. The customer clicks Update Now — WordPress downloads the ZIP from a signed, time-limited URL and installs it automatically.

Support period and update access

If you have enabled a Support Policy on your product, update downloads are gated by the customer's support period:

License statusversion returneddownload_url returned
Valid, support activeLatest versionYes — customer can update
Valid, support expiredLatest versionNo — customer sees latest version number but cannot download
Revoked or expired licenseErrorNo

When download_url is absent, Plugin Update Checker will not prompt the customer to update. The customer keeps their current version and can renew support through your store to regain access.

API Reference

Check for update

GET /api/v1/update-check

No authentication header is required — the license key in the query string serves as the credential.

Query parameters

ParameterRequiredDescription
license_keyYesCustomer's CP- license key
slugYesProduct slug as set in ChargePanda
current_versionYesVersion string currently installed (e.g. 1.2.0)
domainYesThe WordPress site's home URL or hostname

Success response — HTTP 200

json
{
  "name": "Acme Plugin Pro",
  "slug": "acme-plugin-pro",
  "version": "2.1.0",
  "download_url": "https://your-store.example.com/api/v1/update-download?...",
  "sections": {
    "changelog": "= 2.1.0 =\n* Fixed payment redirect on iOS\n* Added dark mode support"
  },
  "last_updated": "2026-06-01 10:00:00",
  "requires": null,
  "tested": null
}

download_url is a signed, time-limited URL (valid for 1 hour). It is omitted when the customer's support period has expired.

Error responses

HTTPerrorWhen this happens
401invalid_licenseKey not found, wrong format, or revoked
401license_expiredThe license key itself has expired
403product_mismatchThe license was not issued for the requested product slug
404product_not_foundNo product with that slug exists in the store
404no_versionsThe product has no uploaded file versions yet
422(validation)A required query parameter is missing

Error responses follow the shape:

json
{
  "error": "invalid_license",
  "message": "License not found."
}

Plugin Update Checker treats any non-200 response as "no update available" and does not surface the error to the customer by default. You can add your own error handling if you want to show a notice when the license is invalid.

Changelog section in the update modal

The changelog field inside sections is shown to customers when they click View version details in the WordPress Plugins screen. Populate it when uploading new file versions in your product's admin panel. Plain text or basic HTML is supported.

Format it like a standard WordPress changelog for a familiar reading experience:

= 2.1.0 =
* Fixed payment redirect on iOS
* Added dark mode support

= 2.0.0 =
* Complete redesign
* Requires WordPress 6.0 or higher

Testing the integration

To verify everything works before releasing your plugin:

bash
# Replace the values with a real license key and your local store URL
curl "https://your-store.example.com/api/v1/update-check?\
license_key=CP-AB12CD-34EF56-GH78IJ-90KLMN-XYZ123\
&slug=acme-plugin-pro\
&current_version=1.0.0\
&domain=https://test-site.local"

A successful response will include version and download_url. If the version returned is higher than current_version, WordPress will show the update banner on your test site.

Released under the Commercial License.