Skip to content

Instantly share code, notes, and snippets.

@gedex
Created November 8, 2016 18:28
Show Gist options
  • Save gedex/4fc8a8ac5450f3f3c67079c987d04d18 to your computer and use it in GitHub Desktop.
Save gedex/4fc8a8ac5450f3f3c67079c987d04d18 to your computer and use it in GitHub Desktop.
WooCommerce Software Add-on Notes

WooCommerce Software Add-on notes

Relationship

  • An order has many license keys (each license is a record in {db_prefix}_software_licenses table)
  • License key has many activations (each activation is a record in {db_prefix}__software_activations)

License key generation

License key is generated when an order containing software product is completed. Buyer receives the license key in order-complete email.

Merchant can add license key of existing order via edit order screen by clicking Add License Key button. Merchant needs to resend completed order email action so the buyer knows about the new license key.

It can also generated programmatically via generate_key request. The last option would be import CSV file.

Activation

GET http://example.com/?wc-api=software-api

With required parameters (passed as query string):

Field Description
request Valid value is activation
email Email in license property (not necessarily the same with email in the order)
license key The license key
product_id Software Product ID associated with license

Additional parameters:

Field Description
instance Pass it to activate existing activation. If empty, new activation record will be created. When empty, its value will be current timestamp. Please note instance is not guaranteed to be unique as the column doesn't have unique constraint.
platform Free. Up to the user
secret_key Not really used internally. Same value is sent back in the response.

Deactivation

Same signature as activation request. But request is deactivation. When instance is not passed, it'll deactivate all "active" activations. Otherwise it only deactivate activations with passed instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment