Skip to content

Sell on WooCommerce with license keys ​

For WordPress sellers with their own WooCommerce shop: the paid "Pro" version of a plugin, a game, an app or a bot. Every paid order gets a SunLicense key, buyers see it in the shop, and a refund revokes it.

There are two ways to connect. Both use the same integration, so you can switch at any time:

Plugin (recommended)Webhook only
SetupInstall SunLicense for WooCommerce, paste two valuesAdd a WooCommerce webhook by hand
Buyers get the keyOn the thank-you page, in My account → License keys, in WooCommerce's order emails, and by our key emailBy our key email and the redeem page
Which productsThe ones you tick in WooCommerce, mapped in SunLicenseEvery product you map in SunLicense
Admin order screenKeys, masked, with Reveal and CopyNothing

With the plugin ​

Coming to wordpress.org

The plugin is waiting for wordpress.org's review. Until it's listed in Plugins → Add New, connect with Webhook only: the plugin uses the same integration, so nothing changes in SunLicense when you switch.

  1. SunLicense: Integrations → WooCommerce → Connect. Map WooCommerce product IDs to policies, or * to give every product you tick the same policy. Copy the integration's hook URL and webhook secret.
  2. WordPress: Plugins → Add New, search for SunLicense for WooCommerce, install and activate it (WooCommerce must be active).
  3. WooCommerce → Settings → SunLicense: paste the hook URL and webhook secret, Save changes, then Test connection. The integration's log in SunLicense shows the test as Order status is connection-test.
  4. On each product you sell with a key, tick SunLicense key next to Virtual and Downloadable, and update the product. Variations follow their product.

Then check the key in your software with an SDK.

What buyers see ​

  • Thank-you page and My account → Orders → View: a License keys table under the order.
  • My account → License keys: every key from their orders (turn the tab off in the plugin's settings if you like).
  • Order emails: the keys under the order table (WooCommerce's Processing order and Completed order emails, HTML and plain text). Emails to the shop show them masked.

Buyers see their own full keys: they paste them into your product. On the admin order screen, the SunLicense keys box shows them masked (AX8P-XXXX-XXXX-XXXX) with Reveal and Copy.

When it runs ​

Order statusThe plugin does
processing, completedSends the order's ticked lines; SunLicense issues one key per product (once, however often it's sent)
refunded, cancelledRevokes the order's keys
anything elseNothing

The call is made before WooCommerce sends its email for the same status change, so the key is usually in the first email. If SunLicense can't be reached, or your automations haven't issued the key yet (Let automations decide), the plugin tries again after 2, 10 and 30 minutes, then hourly for a day; Get keys now in the order's SunLicense keys box tries at once. Partial refunds don't revoke (WooCommerce keeps the order Processing or Completed).

SunLicense also emails the buyer their key as for any store (Settings → Customer emails → License key delivered); turn that email off if you'd rather have only WooCommerce's.

What the plugin sends ​

Only for orders with a ticked product: the order ID and number, status, currency, customer ID, billing first name, last name and email, and per ticked line its product and variation ID, quantity and total. Nothing is sent before you save the settings. The request is signed with the webhook secret like a WooCommerce webhook, and carries a timestamp: SunLicense only answers with keys for a signed request less than an hour old.

Troubleshooting ​

The SunLicense keys box saysDo this
SunLicense refused the signatureThe webhook secret doesn't match: copy it again from the integration page
SunLicense doesn't know this hook URLThe URL is wrong, or the integration is turned off
SunLicense has no policy for these productsMap the product ID (shown in WooCommerce's product list) or * on the integration, then Get keys now
Your SunLicense plan's license limit is reachedUpgrade on Billing, then Get keys now

Webhook only ​

  1. SunLicense: Integrations → WooCommerce → Connect. Map WooCommerce product IDs to policies, or *. SunLicense creates a webhook secret.
  2. WooCommerce Settings → Advanced → Webhooks → Add webhook: status Active, topic Order updated (add a second one for Order created if you like), delivery URL = the hook URL, secret = the one on the integration page, API version WP REST API v3.
  3. Link the integration's redeem page in your order emails. Buyers enter the order number and their billing email.
Order statusSunLicense does
processing, completedOne license per product line (once, however many updates follow)
refunded, cancelledRevokes
anything elseLogged

X-WC-Webhook-Signature (base64 HMAC-SHA256 of the body) is checked. The unsigned ping WooCommerce sends when you save the webhook is acknowledged.

Using both the plugin and a webhook is fine: they send the same order, and SunLicense issues one key per product per order whichever arrives first. With both, a webhook also issues keys for mapped products you didn't tick.

Send feedback

Found something broken, or have an idea? It goes straight to our board.

The first line becomes the title.
Images (optional, up to 5: paste, drop or capture)
Check each image before sending, and remove any that show something private.

We also receive this page's address and your browser version.

Ctrl Enter to send