1. Home
  2. Docs
  3. WooCommerce License Keys
  4. Subscriptions
  5. Via WooCommerce Subscriptions

Via WooCommerce Subscriptions

Only available with WooCommerce License Keys extended plugin.

You can opt to handle your license keys with subscriptions using the WooCommerce Subscriptions plugin. WooCommerce License Keys will integrate itself with the subscriptions plugin the moment both are activated.

How to configure a subscription?

WooCommerce Subscriptions will add a couple of new product types. WooCommerce License Keys only supports license keys on “Simple subscription”.

Check the “License Key” checkbox to enable license key functionality with the subscription and to show the “License Key” tab which will give you access the basic and extended properties.

WooCommerce Subscription licesen key settings

Notice that the “Expire” setting is not enabled for the subscription. This is because the expiration and most of the validity of the license key will be handled and set by WooCommerce Subscriptions.

For variable subscriptions, read this variable product’s article.

How will the API be affected?

Expiration will no longer be validated and handled by the API, instead, the will validate the status and the expiry of the subscription.

Validations and errors

Two new errors may be returned by the API in the response:

900: Subscription is not active.
Returned when no expiration date is found and the status of the subscription is not active.

901: Subscription has expired.
Returned when the subscription returns an expired expiration date.

Response data

Additional data will be returned in the response:

    "subscription_status": "pending-cancel",
    "subscription_is_trial": false,
    "subscription_next_payment_time": 156487956,
    "subscription_next_payment_date": "2019-01-30 23:59",
    "subscription_end_time": 156487956,
    "subscription_end_date": "2019-01-30 23:59",

The status slug obtained from the subscription.

Flag indicating if the subscription is trial.

The UNIX timestamp for the next recurrent payment.

The date for the next recurrent payment (format Y-m-d H:i).

The UNIX timestamp for the end of the subscription.

The date for the end of the subscription (format Y-m-d H:i).

The expire and expire_date values returned are updated based on the subscription. The expire value will be the next payment date when available, it will be the end date if defined and when no next payment is set, or it will return null if nothing is set in the subscription.

Change on “My Account” pages?

Templates must be greater or equal to version 1.2.9 (regular version) and 1.4.0 (extended version).

License Keys page

The “Active” column will display the the subscription number and its status.

Single License Key page

The subscription details will be displayed.

Was this article helpful to you? Yes No