Last updated April 9, 2012. Created by webchick on September 10, 2010.
Edited by LinL, bisonbleu. Log in to edit this page.
About
The UC Recurring Payments and Subscriptions module allows you to add recurring payments to an Ubercart Product so that when an order is placed with that product, a payment schedule will be set up to charge the user a set amount on a regular interval.
Uses
- Mark products as "recurring" billing
- The module exposes a feature which can be added to any product to support recurring payments. There are lots of flexible options for the frequency of billing, payment methods accepted, and what to do if a recurring payment attempt fails.
- Subscriptions
- If used in tandem with the Roles Ubercart feature, this module can be used to sell paid subscriptions to websites.
- Integration with third-party payment gateways
- Support for Authorize.net and Paypal are included in the module. Additionally, a variety of other contributed third-party payment gateway modules exist that implement recurring payment support. Many of these are listed on the project page.
- Recurring payment APIs
- For module developers implementing payment gateway integration, there is an extensive set of hooks for handling recurring billing.
Overview
The package includes the following modules, which are listed under the "Ubercart - recurring" package:
- Recurring Payments API (required)
- Core module to enable recurring payment support in Ubercart. Manages the integration between Ubercart and recurring payment gateways that implement a recurring fee handler. This module does not do anything on its own. It requires a module that creates the recurring payments on specific events like the Recurring Product Fees or Recurring Order module.
- Recurring Product Fees
- This module allows users to specify recurring fees for products.
- Recurring - Hosted Gateways
- Recurring Fees handlers for hosted gateways - Authorize.net ARB and Paypal WPS (TODO: What does that mean, exactly?)
- Recurring Order
- This module allows users to specify entire orders to be re-billed on a periodic basis. Useful for getting a new stock of widgets every 30 days.
Tutorial
This tutorial will walk you through the process of creating a basic, subscription-based site. Note that UC Recurring is a very flexible module and doesn't necessarily require things like payment gateways and Ubercart products, but this is the most straight-forward way to demonstrate what the module can do.
- First, enable all of the required modules to get recurring payments to work. This entails all of the "core" Ubercart modules, in addition to payment-related ones. We'll be using the "Test gateway" in this example to demonstrate how the module works, though in practice you'll likely want a different payment module.
Go to Administer→Site building→Modules (admin/build/modules) and enable the following modules:
- Other package
- Token
- Ubercart - core package
- Cart
- Conditional Actions
- Order
- Product
- Store
- Ubercart - core (optional) package
- Payment
- Ubercart - payment package
- Credit Card
- Test Gateway
- Ubercart - recurring package
- Recurring - Hosted Gateways
- Recurring Payments API
- Recurring Product Fees
- Other package
- Next, we need to create a product that we'd like to be billed on a recurring basis. Go to Create content→Product (node/add/product). Fill out the product's Name, Description, SKU, and Sell price and click the "Save" button.

- On your new product node, click the "Edit" tab, and then the "Features" sub-tab. Here you will be given a choice of various features to add to your product. Choose "Recurring fee" and click "Add".

- The recurring fee product feature offers a variety of configuration options:
- Applicable SKU
- Allows the billing set up to provide to only a single SKU or all SKUs for a given product.
- Recurring fee amount
- Here you can specify how much to charge on each recurring billing or renewal date. This is useful if, for example, your product has an initial $30 activation fee (the sell price), but thereafter costs $5 per month (billing period).
- Payment interval settings
- Here you can specify both the time to wait before charging a recurring fee, and also how often the fee should be charged: daily, monthly, weekly, etc.
- Number of billing periods
- Specify a maximum number of times to charge the recurring fee.
Specify a regular interval of 1 month, leave the other settings alone, and then click "Save feature."

- If all goes well, when returned to the Features sub-tab you should see notification that this product now has a recurring fee attached to it.

- In order for a user to complete the checkout, we must set up a means of payment. Go to Administer→Store administration→Configuration→Payment settings→Payment methods (admin/store/settings/payment/edit/methods) and follow the instructions at Encryption Instructions to enable credit card encryption. Enter a directory under "Card number encryption key filepath" like "../keys".
- Finally, configure the recurring payment settings under the "Recurring payments" tab here (admin/store/settings/payment/edit/recurring). Options at this screen include:
- Valid payment methods
- For customers purchasing products with recurring fees, select valid means of payment (e.g. Credit card).
- Recurring fee checkout form message
- Displays a message to the user on the checkout form if their cart contains products that support recurring billing. It's not a bad idea to remind them, since there's no other visual indication that this will happen.
- Action to take if recurring fee fails to process
- If the payment method is declined, what happens? You can choose to simply return a message and fail to complete the checkout, or to complete the checkout, granting an extension before attempting re-billing.
For the purpose of this tutorial, enable the "Credit card (test_gateway)" as a valid payment method, and then click "Save configuration."

- To test, navigate to the product page and click "Add to cart", then "Checkout". Fill out some dummy address information and credit card data of "4111111111111111", expiration [sometime in the future], CVV of "123". If you entered text in the "Recurring fee checkout form message" field, it will appear at the top of the page.
Click "Review order" to be taken to an order summary, and "Submit order" to complete it.

- To test that recurring billing is working, ensure your test user has "view own orders" permission (admin/user/permissions). Set your system clock to 1+ month ahead and run cron.php. Now, if you view your list of orders from My account→Orders, you should see two charges, each a month apart.

- If your test user also has been granted "view own recurring fees" permission, you'll see a tab at My account→Recurring fees, where you'll find a list of all of your active subscriptions along with "cancel" links to end them.

| Attachment | Size |
|---|---|
| createproduct.png | 102.71 KB |
| configurefeatures.png | 56.51 KB |
| recurringpaymentconfig.png | 127.69 KB |
| recurringpaymentsettings.png | 74.33 KB |
| settingpaymentsettings.png | 196.29 KB |
| recurringcheckout.png | 100.32 KB |
| recurringorders.png | 50.5 KB |
| recurringpayments.png | 58.64 KB |
Comments
Thanks for the tutorial,
Thanks for the tutorial, Angie. Looks like very useful info.
Edit:
With the images, this tutorial now looks smoking. Must read again (and maybe join the documentation team.)
Recurring order
Can you tell us more about recurring orders (as opposed to recurring payments)?
me too.
I'm interested in learning more about this as well. I'm currently using node_checkout to let people purchase content nodes, but seem to be having trouble getting the recurring order to trigger a new node checkout.
Step 7 - Recurring Payment Settings
Note that for the following versions:
UberCart 6.x-2.4
uc_recurring 6.x-1.0 (2009-Apr-28)
In step 7, I couldn't find "Recurring Payment Settings" in the Payment Settings section.
I did, however, find it in Config -> Product Settings -> Product features (admin/store/settings/products/edit/features). This is also where the Role Assignment Settings live.
Project Manager
Forte Web Group
www.fortewebgroup.com
Documentation is spotty
The documentation you referenced is a little inaccurate in places, but not so bad that one can't figure it out. AND, unlike many modules, at least there is some documentation.
Another inaccuracy: Step on: enabling modules. There is no Recurring Payments. There IS a Recurring Payments API. But enabling just that in the list of "Recurring" isn't enough to get the module working. I've started "Recurring Order" and Recurring Product Fees, as well as Recurring Payments API. And the "Features Tab" as documents finally shows up.
great tutorial, thanks! but i
great tutorial, thanks!
but i am a little confused how to go about setting a recurring order, maby someone could elaborate? say i want to have some buy product A and this means that every 2 weeks that product (even thought maby they bought other things at the time) gets renewed, ie i get an email with invoice, attribute options, shippings label, all that.
doesnt look like this does it exactly like that, simply keeps charging without any notification what to ship again?
thanks!
Yes, this is how "Recurring
Yes, this is how "Recurring Product Fees" module work, this tutorial is about it. You need "Recurring Order" module to get separate invoice etc. It is included in http://drupal.org/project/uc_recurring, but the setup process is different.
aha, thanks! have some
aha, thanks! have some suggestion on where i can learn more about how to set that up? having a big issue now trying to carry over attributes and shipping in new orders, but seems not yet implemented, but in the scope according to univate.
I can only suggest to dig
I can only suggest to dig uc_recurring_order.module code as I did. There is only one menu callback in it: a page "/admin/store/settings/orders/edit/recurring" provides a form to setup recurring order options for customers. Once you do it right the form is added to order submission process for customers but not for admin created orders.
oddly enough...
that's all there is to it. go to the page @sin mentions and set up your recurring options (including a non-recurring one if needed) like so:
0 months|One Time1 month|Monthly
1 week|Weekly
Documentation inaccurate
In the paragraph above that states:
Recurring payment APIs
For module developers implementing payment gateway integration, there is an extensive set of hooks for handling recurring billing.
There is a link that is invalid... It would be really nice to know what hooks are available for uc_recurring!
http://drupalcode.org/viewvc/drupal/contributions/modules/uc_recurring/u...
Valid URL for Recurring payment APIs
Here it is. Also fixed in the above mentioned paragraph.
http://drupalcontrib.org/api/drupal/contributions--uc_recurring--uc_recu...
Freelance bilingual Writer Designer Web/Game developer
Is it possible to put down different percentages for payments?
For example, first recurring fee is 10% of the total, then 90% on the second recurring fee? Thanks!