Order Screen
↑ Back to topOrders containing WooCommerce Subscription line items are displayed based on how WC Subscriptions works. All WooCommerce Subscriptions have the API Resources and API Resource Activations displayed on the WooCommerce Subscriptions Parent order screen.
API Resources and API Resource Activations will be displayed on the Switched Subscription order screen rather than the parent order screen after the client chooses to switch their subscription.
Subscription Status
↑ Back to topA subscription is only considered active if it has a Active or Pending Cancellation status. As mentioned in the Order Status section, any order not in completed, or processing if other conditions are met, status will be considered inactive. WooCommerce Subscriptions has its own subscription statuses, but it shares one with WooCommerce, and that is the on-hold status, which is considered an inactive subscription. Read the following sections to see how API Keys are handled in these situations.
Switched Subscription
↑ Back to topA WooCommerce Subscription product that is a Variable Subscription type has a Parent product that has one or more variation products, each with their own unique Product ID created by WooCommerce, and used by the API Manager to identify each variation, and locate information stored for that product, such as the download URL for software updates. Client software, such as the API Manager PHP Library, must authenticate using a Master API Key, or a Product Order API Key, and the Product ID unique to every product in the WooCommerce store. If a Subscription has been switched to a different Variable Subscription product variation, the API Resources and API Resource Activations will be displayed on the Switched Subscription order screen rather than the parent order screen, and the Product Order API Key will change, but the Master API Key will remain unchanged. The API Resource Activations for the switched Variable Subscription product variation will be deleted because the Product ID will have changed. If the API Resource Activations were not deleted, the client would receive an error the next time the client software checked for a software update, and the client would see many activations already exist for a product they are no longer subscribed to, and the client would need to login to the My Account dashboard, go to API Keys, and figure out which activations to delete for a product they no longer subscribe to.
If the client is using a Product Order API Key then the client needs to change the Product ID and the Product Order API Key, or download new software that has the Product ID, to reactivate the API Key. If the client is using a Master API Key then the client only needs to change the Product ID, or download new software that has the Product ID, to reactivate the API Key. It is much easier for the client to always use the Master API Key with WooCommerce Subscription products.
The API Manager currently has an API Access Expires field for Simple Product types that are not a WooCommerce Subscription product. In the future it is planned to allow this to become a feature rich alternative to WooCommerce Subscription products, that will allow clients to increase/decrease activations without changing subscriptions, and to continue to use the same activations without disruption.
API Key Expiration
↑ Back to topAPI Keys for WooCommerce Subscription products will only work if the subscription has an Active or Pending Cancellation status. If a subscription has a status other than Active or Pending Cancellation status, and the client queries the API, views the API Keys or API Downloads, or if the store owner views an order containing an API Product, the API Manager automatically checks if the API Products still have an Active or Pending Cancellation status, and if not then the API Key activations associated with that API Product are deleted.
Subscriptions not in Active or Pending Cancellation status, and orders not in completed status, or processing status if other conditions are met, will have the API Key activations, and API Resources, deleted. If the order is placed back into completed status, or processing status if other conditions are met, the API Resources will be recreated, but the API Key activations will not, which also applies to a subscription that returns to Active status. Why are activations deleted? Client software will, or should, receive an error if it tries to send a query with a Product ID that is no longer considered active, but the customer may not realize he/she would need to delete activations in his/her My Account dashboard before reactivating the client software, so those activations are deleted to eliminate known support issues customers commonly have related to this. All the customer should have to do once they have brought their account back into good standing is to reactivate their software.