Change User Role On Payment Success Drupal 7 Paypal Payment Gateway Ubercart Tutorials

Learn how to make Shopping Cart in Drupal 7 and Integrate Paypal Payment Gateway.
In this PlanetGhost Premium Tutorial Learn how to:
1.Change User Role On Payment Success.
2.Display/Show content (Block/Page/Field) to new assigned Role.(Content not Visible to Anonymous Users will be seen to them once the payment is successfully made.)

You can use this Setup when you want to make paid services in which you ask visitor to pay to view certain content/text. And Dont want to manually check whether payment was successful and hence change the Role for user. Instead want the role to automatically change once payment made due to which the user will get a better experience of service in your Site.

To create a shopping cart in Drupal 7 very commanly used module Ubercart

Note: To Install Ubercart Module you need Prerequisite Modules:


and To Install Views Module you need Prerequisite Module Ctools

Besides Ubercart will need Prerequisite Modules Rules and Entity

Learn to install Module

Once Installation is Done

We will Start by Creating a New User Role Learn how to Create New Role which will be assigned to user on payment success.

Once New Role Made
1.Select the following modules  Cart,Order,Product,Store

2.Also Select Paypal Module as we will be integrating PayPal Payment Gateway

3.Select Roles Module Under UberCart as we will be assigning new Role to User On Payment Success

3.It might ask you to enable other modules. Click Continue Button.

4.Click on Store Link.

5.Now click on Payment Methods.

6.Now Select PayPal Website Payments Standard ONLY and hit Save Configuration

7.Click on settings respective to PayPal Website Standards.

8.Place your Paypal Email address 
Note:- For Testing you have to place your paypal sandbox email address created by .
Note: Keep this Drupal Setup in Server Accessible to Internet. For Example in server . Changing of Role on
payment success might only work then. However If your working
in localhost everything else will work apart from automatic
changing of role on payment success.
If you have placed your Sandbox 
Account PayPal Email.
Select Sandbox option For PayPal Server .
 Hit the Save Button. 

Or place your Paypal Live email Address created by
If you have placed your Live
Account PayPal Email.
Select Live option For PayPal Server . 
 Hit the Save Button.

9.Click on Add content > Product 

10.Give the Product Name. Optionally you can upload Image too 

Place the Product Price in the Text fields and Hit the Save & Continue Button 

11. Now Click on Features 

12. Select Role Assignment and Click on Add

13. Select the SKU Code of product and the Role you want to set for user on purchase.

14. You can test the Setup by Clicking on "Add to Cart" Button for the New Product just created.

15.Now Click the Checkout Button

16.Fill all required details and Click on 'Review Order'

17.Now Click on 'Submit order'

You will reach PayPal Website Page after the payment made you will return to your Website.

On Returning you will see some Page Like that with user
name and password. On Logging in with this user id
Password you will see the Role assigned to this particular

If You Think This Post has helped you buy us a Coffee :)

Make Donation

  • Other: $

Donate now