Building a Subscription Service with Drupal & Recurly

Building a Subscription Service with Drupal & Recurly 5 min read

Implementing a subscription service on the Drupal platform can be a real pain. There is a LOT of information to sift through and it can leave you utterly confused. Today, I’d like to promote a singular service that we’ve had success with: Recurly. If you’re new to subscription services within Drupal, I would recommend you take a look at our article on Building a Subscription Service on Drupal.


That said — I’d like to give just a general overview to provide some implementation details and what you’ll need to take into account. The actual technical implementation will be handled in a later tutorial.


To get started, you’ll need to download and install the following:

  1. Recurly
  2. Recurly Roles
  3. Recurly Rules (Optional)
  4. Recurly.js Library (v2.0)



This module integrates the core components that you’ll need to get started with the Recurly service. You’ll need to ensure that you have the Recurly.js library installed before you can use it, though (Note: At the time of writing this article, only version 2.0 will work with this module).


The main benefit here is that Recurly provides you with the ability to handle dunning management — a fancy term for making sure users pay when they’re delinquent or their account has expired. This is an incredibly valuable feature and can save you a ton of time when trying to handle the activating and cancelling memberships. While the module itself is fairly new, it is pretty well supported (aside from the Rules portion).


The only peculiarity I have to note here is that since it uses version 2 of the Recurly.js library, the location for the API key is different. If you install this module and can’t figure out where it is, you’ll need to contact their support team to enable it for you.


» DownloadRecurly


Recurly Roles

Of course you’ll need a way to sell user roles for your new subscription service. This integration provides you with the ability attach the roles in Recurly with the ones that you create in Drupal. The setup is fairly intuitive and shouldn’t provide too much fuss.


» DownloadRecurly Roles


Recurly Rules

This gem is buried within a forum thread and hasn’t been adopted by anyone yet. It provides basic support for push notifications. When a user signs up for a new account, Recurly sends a push notification to your Drupal site. This module will allow you to determine what the push notification is and act accordingly.


» DownloadRecurly Rules (Optional)



I encourage you to go ahead and start playing around with these three modules. Recurly has a free account that you can use until you’re ready to start accepting payments.  Please feel free to leave any questions you may have below!

  • Sam Roy

    Has anything changed with v3 of Recruly.js … I’m thinking of using Recurly Rules to act on purchase success to reward an affiliate (if its the case).

  • Hey Sam — The module maintainers are making preparations to update the module to v3 of Recurly.js. Right now it still operated on v2 which has been deprecated ( I had some issues with the Recurly Rules patch and how it worked but your use-case may work better. I should note that they recommend not using the push notifications for any business logic. They occasionally go down which can be a pain.

  • Sam Roy

    Intermittent connection issue, I agree, a pain, but is there a way to catch and queue perhaps; I’m assuming they resend push notifications.

    I’m using Post Affiliate Pro to reward users when a subscription is purchased (we’ll, that’s the idea). They provide an API to register sales when a SuccesFull Recurly purchase is completed. In this case, the code must run on the SucessURL. It would of been easy with rules.

    The solution seems to be hooking into Recurly to execute that PHP code when the right condition is met. (and I think again of failed push notifications, darn…)


Related Posts