Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Paypal enrolment.

Paypal enrolment

From MoodleDocs
(Redirected from Paypal)

Location: PayPal edit settings link in Site administration > Plugins > Enrolments > Manage enrol plugins in 2.0 onwards or Administration > Courses > Enrolments pre-2.0

The PayPal enrolment plugin allows you to set up paid courses. It may be enabled via Site administration > Courses > Enrollments. You can use the edit link to set a standard course cost default.

Setup Steps: Moodle Course Enrollment & Paypal

The following steps are based on Moodle release = '1.9.5+ (Build: 20091007) and Paypal as of Feb 2011.

In Moodle:

  • Create a course
  • After the course is complete, from the main Moodle page (after logging in as an Administrator) click on the course name and then click on "Settings" on the left navigation bar. In the new page that appears, do the following:
  1. Scroll down to the "Enrolments" section and fill it out:
    1. Enrolment Plugins: Paypal
    2. Default role: Site Default (Student)
    3. Course enrollable: Yes
    4. Enrolment duration: 30 days (or whatever you want)
  2. "Enrolment expiry notification" section (these settings are optional but it is always good to communicate):
    1. Notify: Yes
    2. Notify students: Yes
    3. Threshold: 10 days
  3. "Availability" section
    1. Availability: "This course is available to students"
    2. Enrolment key: <left blank> (not required; optional)
    3. Guest access: "Do not allow guests in"
    4. Cost: enter a price (like 100.00) and select currency (like "US Dollar")
  4. Save changes
  • Now on the main Moodle page after logging in, it should list your course with a price under it.

Setup email based self-registration

  • Log into Moodle as the Administrator
  • Select "Site Administration > Users > Authentication > Manage Authentication"
  1. Enable "Email-based self-registration" (make sure the eye appears next to this)
  2. Scroll down and fill in the rest of the fields
    1. Self registration: "Email-based self-registration"
    2. Guest login button: Hide
    3. Restrict domains when changing email: checked
    4. Fill in ReCAPTCHA keys (go to and fill out the form to create an account; it will then provide you with the public key and the private key to use on this form)
    5. All other fields are blank
    6. Save Changes
  • Now select "Site Administration > Users > Authentication > Email-based self-registration"
  1. "Enable reCAPTCHA element": Yes
  2. All other fields: Unlocked
  • Now select "Site Administration > Courses > Enrolments"
  1. PayPal enabled, set to Default
  2. "Send course welcome message": Yes
  3. PayPal Edit button:
    1. Provide an enrolment cost (this is a global cost, individual course costs defined in the step above will override this setting), currency and your personal/business email
    2. Check all the checkboxes so that emails are sent
    3. Save changes

In Paypal:

  • Setup your PayPal account at
  1. Create a Paypal account
  2. Not required but recommended for selling: Upgrade your account to "Premier" status and get "Verified"
  3. Setup IPN in Paypal to interact with Moodle. Log into Paypal, go to "Profile > Instant Payment Notifications (IPN)”, click "Turn On IPN", click the "Edit settings" and enter a URL that references your IPN file in your Moodle installation (for example: http://<domain name>/moodle/enrol/paypal/ipn.php)
  4. Set the Encoding to UFT-8. In Paypal, go to "Profile > Language Encoding" (under the Selling Preferences column) and set your website's language (like select "Western European Languages (including English)" as it is the only English version). Then click on the "More Options" button and set the Encoding to "UTF-8", select "Yes" to use the same encoding for data sent from Paypay to you, and save.
  • Do not use a PayPal button on your website
  1. Instead, on your website provide a link to your main login page for your Moodle installation. It will now have a section on the right for 'firt time users' with a "Create new account" button. This is how the process will start now.

Workflow - Now the workflow goes like this:

  • On your website links to the main login page for Moodle (looks something like: http://<domain name>/moodle/login/index.php)
  • Click the "Create new account" button
  1. Fill in the form (this is the "Email-based self-registration" form with the reCAPTCHA at the bottom) and click the "Create my new account" button
  2. You will get a web page saying to check your email for instructions on completing your registration.
  • Log into your email and you should have an email. It will have a URL to click in order to confirm the new account. Click it.
  • A new Moodle page will appear saying "Thanks, <name>" "Your registration has been confirmed"
  1. Click the "courses" button
  • Now it lists all the courses available. When you click on one of the course names that you want to take, it brings you to a page that has the course summary and the price displayed. Below this is another section that says "This course requires a payment for entry", shows the price and now has a PayPal button that says "Send payment via PayPal". Clicking this sends you to PayPal with the course listed in the order summary and you can log in to pay.
  1. Once done paying you will receive an email confirmation and a link to the main Moodle login page that you provided in the Paypal setup.
  2. The user should be able to log in now to take the purchased course.
  3. Likewise you will have received emails from Paypal on the purchase and the user/student will have received a confirmation receipt from Paypal also.

Course costs

Costs for each course can be set separately. If the cost for any course is zero, then students are not asked to pay at the time of enrolment into the course. However, if there is a site wide default course cost, you may override that in your course settings.

If the course cost field is not empty, then students trying to enrol will be presented with the option of making a payment to enter.

If you ALSO enter an enrolment key in the course settings, then students will also have the option to enrol using a key. This is useful if you have a mixture of paying and non-paying students.

Verifying the default encoding


If you are using Moodle 1.8 or later, you need to verify the default encoding in your PayPal business account as follows:

  1. Login go to your PayPal account, select "My Account" tab, then Profile tab.
  2. Click on "Language Encoding" in the right column Selling Preferences.
  3. Click on "More Options" button and select UTF-8 encoding for both cases. If you are using other software with IPN please check that it is compatible with UTF-8 encoding.

See also