fbpx
  1. Home
  2. Knowledge Base
  3. Tips, Tricks and Customizations
  4. Tips and Tricks
  5. Customizing the Schedule for Overdue Payment Rebill Attempts

Customizing the Schedule for Overdue Payment Rebill Attempts

MemberMouse 3.0+

NOTE: With payment services that don't support card-on-file functionality (i.e. PayPal, Authorize.net), MemberMouse has no control over the recurring billing process and does not automatically handle overdue payments.

By default, MemberMouse has a built-in dunning process for overdue payment collection. If a subscription fails to bill on the scheduled date, MemberMouse makes three additional attempts over the span of one week to collect the payment. MemberMouse will also send out a configurable overdue payment notification after each failed payment. If you'd like to review a detailed description of this process, go to our article Automated Overdue Payment Handling.

You can adjust the times between each billing attempt, but the three attempts can not be changed. This is a hard-set number.

While this collection interval works great as a default, you may find that you want to customize the days that elapse between a collection attempt and the duration of your overall collection process. This is possible to customize by using a WordPress filter, mm_billing_subscription_dunning_interval.

Filters are functions that WordPress passes data through at certain points in execution just before taking some action with the data. MemberMouse defines its own set of filters that you can utilize to control the flow of execution in MemberMouse prior to certain actions being taken.

Here's a basic example:

function customContentProtection($data) 
{
     return true;
}
add_filter('mm_bypass_content_protection', 'customContentProtection');

In this example, we're using the add_filter() method to indicate that the  customContentProtection() method should be called when MemberMouse applies the  mm_bypass_content_protection filter.

To learn more about working with WordPress' Action API read this article.

Customizing the Dunning Intervals

MemberMouse passes two arguments to your function. First is an integer $failureInterval which represents the default number of days before the next attempt will be made. Second is an integer $failureState which represents the particular failed billing state. Three failure states currently exist: 2, 3, 4 which represent the second, third, and final attempt to collect payment, respectively.

Your function should return an integer representing the number of days that should be allowed to elapse before the next attempt. Here's an example that replicates the default dunning intervals:

function customDunningInterval($failureInterval, $failureState)
{
   switch ($failureState)
   {
      case 2:
         return 2; // First retry, two days after initial rebill failure 
      
      case 3:
         return 3; // Second retry, three days after first retry
      
      case 4:
         return 2; // Third retry, two days after second retry
      
      default:
         return $failureInterval;
   }
}
add_filter("mm_billing_subscription_dunning_interval", "customDunningInterval", 10, 2);

To customize the dunning intervals, you can simply change the values returned in the three case statements to your desired length in days.

So if you wanted to retry the payment 3 days, 5 days and then 7 days after each attempt, you would change the function to look like this:

function customDunningInterval($failureInterval, $failureState)
{
   switch ($failureState)
   {
      case 2:
         return 2; // First retry, three days after initial rebill failure 
      
      case 3:
         return 3; // Second retry, five days after first retry
      
      case 4:
         return 2; // Third retry, seven days after second retry
      
      default:
         return $failureInterval;
   }
}
add_filter("mm_billing_subscription_dunning_interval", "customDunningInterval", 10, 2);
Was this article helpful?

Related Articles

Can’t find the answer you’re looking for?

Reach out to our Customer Success Team
Contact us!