[Drupal] Drupal Tips: How to customize Ubercart for recurring payments?
Recently, we have come across with a Drupal website requirement which needs Ubercart customization for recurring payments. The site features monthly and annual subscriptions for membership. Users will be assigned a special role - 'member' on subscribing to any of the monthly or annual plans. Let us see how to configure Ubercart to achieve this.
Step 1: Download and install the modules required
Go to Administration » Modules
and enable the required modules.
Module checklist: Make sure you have the following modules installed and enabled on your Drupal site.
» Rules (http://drupal.org/project/rules)
» Token (http://drupal.org/project/token)
» Entity (http://drupal.org/project/entity)
» Views (http://drupal.org/project/views)
» Chaos tool suite( http://drupal.org/project/ctools)
We would require the following modules:
» Ubercart (http://drupal.org/project/ubercart)
» UC Recurring Payments and Subscriptions (http://drupal.org/project/uc_recurring)
Enable the following modules for a basic installation:
» All items under - UBERCART - CORE
» 'Payment' and 'Roles' under UBERCART - CORE (OPTIONAL)
» 'Credit card' and 'Test gateway' UBERCART - PAYMENT
» 'Recurring - Hosted Gateways', 'Recurring Payments API' and 'Recurring Product Fees' UBERCART - RECURRING
Step 2: Create a role - "member"
- Go to
Administration » People » Permissions
and add a new role - 'member' - Click on the 'edit permissions' link and allow permission for desired privileges.
Step 3: Create your products and add features to it.
Go to Add content » Product
and create a product.
Enter the Product details
» Name: Monthly Subscription
» SKU: Membership
» IMAGE: Optional
» Sell price: $10
» Uncheck the field - 'Product is shippable'.
Then click 'Save and Continue' button to proceed further.
Add features to your product
Find the 'Features' button on top of the product edit page and add the following features:
» Role Assignment
» Recurring Fee
Step 4: Configure Ubercart
- Go to
Administration » Store » Configuration » Products: Role Assignment Settings
to set product roles to 'member'. - Go to
Administration » Store » Configuration » Payment methods
and click on 'settings' link against your selected payment method to configre the test gateway and security settings for credit card. Once the test gateway works fine we can proceed further to configure Autherize.net Gateway and sandbox testing for receiving payments. - Go to
Administration » Store » Configuration » Recurring Payments
to configure Recurring Fees. Select 'Credit card (test_gateway)' to test with test gateway.
That's it! Now try purchasing the subscription. When the payment is complete the role - 'member' will get automatically assigned to the user.