edd_software_licensing 0.9.0 copy "edd_software_licensing: ^0.9.0" to clipboard
edd_software_licensing: ^0.9.0 copied to clipboard

A library for accessing Easy Digital Downloads software licensing API

example/edd_software_licensing_example.dart

import 'package:edd_software_licensing/edd_software_licensing.dart';

void main() async {
  var eddLicensingClient = EddSoftwareLicensingClient(licenseHost: 'google.com');

  // Activate a license
  var activateResponse = await eddLicensingClient.activateLicense(
    itemId: 1,
    licenseKey: 'MYLICENSEKEY',
  );
  if (activateResponse.isRequestSuccessful() && activateResponse.isLicenseValid()) {
    // License was activated
  } else {
    // Figure out what went wrong
    if (!activateResponse.isRequestSuccessful()) {
      // We got a HTTP server error
    } else {
      // We got a licensing error
      var licenseStatus = activateResponse.license;
      var errorMessage = activateResponse.error;
    }
  }

  // Check the activation
  var checkResponse = await eddLicensingClient.checkLicense(
    itemId: 1,
    licenseKey: 'MYLICENSEKEY',
  );
  if (activateResponse.isRequestSuccessful() && activateResponse.isLicenseValid()) {
    // License is good
  } else {
    // Figure out what went wrong
    if (!activateResponse.isRequestSuccessful()) {
      // We got a HTTP server error
    } else {
      // We got a licensing error
      var licenseStatus = activateResponse.license;
      var errorMessage = activateResponse.error;
    }
  }

  // Deactivate the license
  var deactivateResponse = await eddLicensingClient.deactivateLicense(
    itemId: 1,
    licenseKey: 'MYLICENSEKEY',
  );
  if (checkResponse.isRequestSuccessful()) {
    // License is deactivated
  } else {
    // Figure out what went wrong
  }

  // Get latest version of software
  var versionResponse = await eddLicensingClient.getVersion(itemId: 1);
  if (versionResponse.isRequestSuccessful()) {
    var newestVersion = versionResponse.newVersion;
    var stableVersion = versionResponse.stableVersion;
  }
}
1
likes
160
points
17
downloads

Publisher

verified publisheratomic.city

Weekly Downloads

A library for accessing Easy Digital Downloads software licensing API

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on edd_software_licensing