Drupal Commerce Blog

What's happening in the world of Drupal Commerce.

Commerce Module Tuesday: Commerce Dunning - Part 2

Commerce Dunning, Part 2

Welcome to another Commerce Module Tuesday! Today we are looking at Commerce Dunning, Part 2. Last week we looked at what a "dunning process" looks like. Today, we're going to look at the Commerce Dunning module and the testing environment that comes with it. This is actually one of the hardest parts of a recurring setup to test, the failures. The module that we are creating here at Commerce Guys makes it very easy to test payment failures and work through all of the emails and touch points that you can set up as part of your dunning management.


1) Watch the excellent Card on File and Recurring Framework Commerce Module Tuesdays by GuGuss: http://commerceguys.com/blog/commerce-module-tuesday-commerce-card-file and http://www.drupalcommerce.org/blog/8477/commerce-module-tuesday-commerce...

2) Enable the Commerce Recurring, Commerce Card on File, Commerce Dunning, Commerce Dunning Defaults and Commerce Dunning Testing modules.

3) Create a recurring product and checkout with that product using Commerce Dunning Testing Payment. Store the card for later use.

4) Edit the recurring entity that references your newly created order, so that it's due date is today.

5) Navigate to the Configuration > Development > Commerce Dunning Testing.

6) Set the status of the next payment to a failure of your choice.

7) Run cron. A new order with a status "recurring pending" will be created.

8) Run cron one more time and you will see that your payment for the order has failed because of the error you selected before. Dunning module takes over from here.

9) You should have an email that the payment failed and a bunch of actions that are scheduled to happen (you can check out those at Configuration > Development > Commerce Dunning Testing).

10) You can evaluate the scheduled actions on the testing page and see what will happen.

So that's our Commerce Module Tuesday, hope you enjoyed it! Note that Commerce Guys is also running a Turbo Ticket giveaway which you can see in the upper right hand corner of the sidebar. Sign up today to get a free Turbo Ticket to use any way you want, including advice on setting up Commerce Dunning! :)

Posted: Aug 13, 2013


joshmiller Josh Miller on August 13, 2013

I did check with the Commerce Guys per a request from some of the Mediacurrent devs and the ability to have recurring Orders is a possibility. The trick is to have at least one recurring product on the Order. I will have to run through this to be able to explain it in more detail, but it sounds like you include one recurring product in an Order and the whole Order can recur.

Doesn't quite right, but will have to do a bit more research to get to the bottom of the idea.