In the last blog post, I talked about the structure of how certificates would be created. I would now be talking a bit about the renewal process in WooCommerce subscriptions and how it relates to the renewal of the certificates as well.
Subscriptions in general involves having recurring payments that are due at regular intervals, e.g: a week, a month, a year, etc. When the payments are made before or by the due date, the subscription is said to be renewed. There are two methods of renewal in regards to the WooCommerce subscriptions:
- Automatic renewal
- Manual renewal
Automatic renewals would mean that the recurrent payments are made automatically without involvement from the customers and the WooCommerce store manager. The payment is processed by WooCommerce Subscriptions using the payment gateway that was used to purchase the subscription in the first place, such as with Paypal, hence the amount is deducted by the due date. This method would be the most convenient for the customers, of course.
On the other hand, there are manual renewals, in which an email would be sent to the customers to remind them of their recurring payment, and at that point, a new order for the renewal would be generated. Then, the customer is required to log in to the WooCommerce and make the necessary payments, thus reactivating the subscription in correspondence to its subscription period.
Actually, there is a third kind of renewal, and that is resubscription. When a subscription is expired or cancelled by the customer, they have the option to resubscribe to that product, and doing so would result in a new subscription that follows the terms of the old subscription. However, there are some caveats to the resubscription process, hence it is not the same as renewing the subscription as I have mentioned above. More on this here. There is also a flowchart from the WooCommerce Subscription documentation, that gives the overall flow of how the automatic and manual renewals would work.
So going back to our certificate products, the validity period of the certificates must follow the period of recurring payments for the subscription. Thus, when a renewal is made, a new certificate would be created but the customer’s data would be imported from the old certificate, with the only difference being the validity period. The new validity period would start from the date of payment for the renewal, and end at the date of the next payment date. A webhook will be triggered for when a Subscription Updated event is done, such as the confirmed renewal of the subscription in this case. I have only been trying out manual renewals for testing purposes at the moment, but the automatic renewals should have no issues as well, although we should reconfirm it when the time comes to use it.