Testing Subscription Renewal Payments

This is a technical guide to testing subscription renewal payments. It is written for WooCommerce developers to help them understand how to use the underlying scheduling system in WooCommerce Subscriptions.

For a non-technical method to test subscription renewal payments, please refer to the Process Renewal Action covered in the Store Manager Guide.

Once you have WooCommerce Subscriptions active on your site, you may want to test subscription renewal. When using a payment gateway other than PayPal or WorldPay, you don’t have to wait 24 hours (the minimum billing period) for a renewal to be processed.

However, if you are using PayPal or WorldPay, this process will not work and you must wait until the payment gateway processes the renewal (which can be anywhere from 24 to 48 hours after the purchase of a daily subscription in PayPal’s case).

Purchase a Test Subscription

↑ Back to top

If you have not already purchased a subscription to test, purchase a test subscription using the payment gateway you wish to test. After completing the purchase, take note of the order number for the subscription.

Trigger the Renewal

↑ Back to top

Now you have a test subscription and your site is in debug mode, you can trigger the renewal.

  1. Visit your site’s administration dashboard.
  2. Go to: WooCommerce > Status > Scheduled Actions.
  3. In the search box, enter subscription ID.
  4. Find the row with the hook ‘woocommerce_scheduled_subscription_payment’ and the status pending.
  5. Hover over the row and and click Run

Clean Up

↑ Back to top

In versions of Subscriptions before 2.1.3, once you have triggered the renewal successfully, if the subscription renewal is processed correctly with an automatic renewal method, you will end up with two pending scheduled_subscription_payment actions.

You can find and trash either of these actions from the Scheduled Actions screen. Which scheduled action you choose to trash depends on which schedule you wish to keep.

Scheduled Actions admin screen pointing to the `woo_scheduled_subscription_payment` hook.

Troubleshooting Issues with Subscription Renewals

↑ Back to top

If there are subscriptions that appear to be active but display a renewal date in the past, it is likely due to a Cron issue. Follow these steps to troubleshoot the problem:

  1. Verify that WP Cron is enabled. You can do this by accessing the status report in your WordPress admin area under WooCommerce > Status > Tools. If WP Cron is disabled, you will need to enable it.
WordPress cron status within the WooCommerce System Status Report
  1. After confirming cron is enabled try changing the next payment date ( if your payment gateway allows changes ) to one hour from now.
  2. This should trigger a new scheduled action to process a future renewal. If subscription renewals are not processing still, please consult the documentation titled “Complete Guide to Scheduled Events with Subscriptions” to troubleshoot WP Cron.