Note: You are currently viewing documentation for Moodle 4.0. Up-to-date documentation for the latest stable version of Moodle may be available here: PayPal enrolment.

PayPal enrolment: Difference between revisions

From MoodleDocs
m (removing new features template)
 
(30 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Enrolment}}
{{Enrolment}}
Location: PayPal edit settings link in ''Site administration > Plugins > Enrolments > Manage enrol plugins''
{{Note|A new recommended enrolment method for paying with PayPal is available - [[Enrolment on payment]]. Enrolment on payment provides the option of having multiple [[Payment gateways]].}}


The PayPal enrolment plugin allows you to set up paid courses. The plugin has to be enabled by the site administrator (see [[Enrolment_plugins|Enrolment plugins]])and then added to the course by an administrator or manager. You can then set an individual price for your course if needed.
==What is PayPal enrolment?==


==Course settings for Paypal==
PayPal enrolment allows users to pay for courses and then be automatically enrolled.  
===Checking you have Paypal in your course===
*In a course, go to Administration> Course administration>Users>Enrolment methods
*If you do not see PayPal, use the pull down menu "Add method" and select PayPal.


*Make sure PayPal has its "eye" opened:
==What is the difference between PayPal enrolment and Enrolment on payment?==


[[File:Paypalenrolmentmethod.png]]
[[Enrolment on payment]] provides more features than PayPal enrolment, such as the option of having multiple [[Payment gateways]].
 
The PayPal enrolment plugin uses PayPal's old API which still works, though PayPal encourages the use of the new API, as done for the PayPal payment gateway plugin.
 
PayPal enrolment can still be used but will be removed in a future version of Moodle.
 
For these reasons, it is recommended that you use Enrolment on payment rather than PayPal enrolment.
 
==PayPal side setup==
 
# Create a PayPal account at https://www.paypal.com
#* Although not required, it may be wise to upgrade your account to "Premier" status and get "Verified".
# Set the encoding to UTF-8.
#* Go to Profile > Profile and settings > My selling tools > More selling tools > PayPal button language encoding
#* Make sure you have your website's language set to Western European Languages
#* Click the "More Options" button
#* Set encoding to "UTF-8" and let the same encoding be used for IPN, too.
# Enable instant payment notifications (IPN)
#* Go to Profile > Profile and settings > My selling tools > Getting paid and managing my risk > Instant payment notifications > Update
#* Turn IPN on and set the notification URL to your site's enrol/paypal/ipn.php (so it reads for example like <nowiki>https://my.school.edu/moodle/enrol/paypal/ipn.php</nowiki>).
 
You may wish to log in to https://developer.paypal.com/developer/accounts/ and experiment with PayPal Sandbox first. If doing do, put this to your config.php:
 
    $CFG->usepaypalsandbox = 1;
 
PayPal can provide more details, but as a high-level overview you will:
# Create "sandbox" accounts that are used for testing. At least one "BUSINESS" account is needed, and one "PERSONAL" account is needed, to represent both sides of a pretend transaction.
# These sandbox accounts will be registered/associated with the developer account for your REAL PayPal business account.
# When testing, in addition to the configuration flag above, remember to use the "BUSINESS" type sandbox account email address in the "PayPal business email" field in the PayPal plugin settings page. Do this instead of using your REAL business email address. Failure to use the pretend business account will result in an error message.
 
==Enabling PayPal enrolment==
 
{{MediaPlayer | url = https://youtu.be/Prir-5hduws | desc = How to set up payment for courses}}
 
An administrator can enable PayPal file enrolment as follows:


===Setting a price for your course===
# ''Go to Site administration > Plugins > Enrolments > Manage enrol plugins'' and click the eye icon opposite PayPal. When enabled, it will no longer be greyed out. [[Manual enrolment]] must also be enabled, since the PayPal plugin requires it.
*In Administration>Course Administration>Users>enrolment methods, click the edit/hand/pen icon to the right of the Paypal option.  
# Click the settings link, configure as required (see details of settings below), then click the 'Save changes' button.
*Give a name to this enrolment method if you wish in "Custom Instance name". (You don't have to!)
*Ensure that "allow Paypal enrolments" is set to "yes"
*In "Enrol cost", type in the cost of your course and in "Currency" choose your currency.
Note: In Moodle 2.5 onwards, all Paypal-supported currencies are available.
*Usually you would leave the "Assign role" as "student" unless you have a very special reason for allowing your users to enrol as, say, editing teachers etc
*Choose an enrolment period and/or start/end dates if desired.
*Click the "Save changes" button.


[[File:Paypalcoursesettings.png]]
* PayPal business email - This setting is case sensitive and must exactly match that in PayPal
* Default role assignment - This means the role that a new user will automatically be given in a course when they purchase access. Usually this would be "student" unless you have a special reason for choosing another role. As for other default settings, it may be overridden in individual courses.


===What the new user sees===
Tip: If you wish to allow users to create their own accounts on your site then you need to set up [[Email-based self-registration|Email based self registration]].
*When a new user clicks on your course link, having made a login to your Moodle, they will see the following screen, inviting them to go to PayPal to purchase access to your course:


[[File:Paypaluserview.png]]
==Course settings for PayPal==


==Admin settings==
===Checking you have PayPal in your course===


#If you wish to allow users to make their own accounts on your site then set up [[Email-based_self-registration|Email based self registration]]
# If you are using the [[Boost theme]], from Course administration, click Participants and from the dropdown select Enrolment methods. If you are using a different theme, go to ''Course administration > Users > Enrolment methods''
#Go to ''Administration>Site Administration>Plugins>Enrolments>Manage enrol plugins'' and enable (open the "eye" of Paypal)
# If you do not see PayPal, use the pull down menu "Add method" and select PayPal. If you are a course teacher, your admin will need to allow you the capability ''enrol/paypal:config'' in order for you to add this method.
#Click the blue Settings link to the right of the PayPal enrolment link. Here are the default settings and default settings for new instances in a course:
# Make sure PayPal has its "eye" opened:
##Add the email of your Business PayPal account. The email settings are case sensitive and must exactly match that in PayPal.
##Choose whether to notify students/teachers/admin.
##Choose whether (or not) to allow the Paypal enrolment plugin by default in new courses
##Choose a default cost and currency. (This may  be overridden in individual courses)
##Choose a default role assignment. (This means the role that a new user will automatically be given in a course when they purchase access. Usually this would be "student" unless you have a special reason for choosing another role.) This may be overridden in individual courses.
##Choose the default enrolment period. This may be overridden in individual courses.


==What to set up in Paypal==
[[File:Paypalenrolmentmethod.png]]
* Setup your PayPal account at paypal.com
{{Note|Make sure you don't have [[Self enrolment]] enabled as this would allow users to access the course without paying. If you do need some users to self enrol for free, then add an [[Enrolment key]] in the self enrolment settings.}}
# Create a Paypal account
# Not required but recommended for selling: Upgrade your account to "Premier" status and get "Verified"
# 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.
# Optionally 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)


==What the user sees==
===Setting a price for your course===
*If you have allowed users to create their own accounts then when they click to login, they will be presented with a screen'' Is this your first time here?'' It will give them instructions for making an account (which may be customised in the authentication common settings in ''Administration > Site administration > Plugins > Authentication > Manage authentication'') and once their account is confirmed via email they can click on a course which can be purchased and pay for it via Paypal. PayPal courses will have a dollar sign icon next to them:


[[File:Paypalicon.png]]
# In ''Course Administration > Users > Enrolment methods'', click the edit/hand/pen icon to the right of the PayPal option.
# Optional: Give a name to this enrolment method if you wish in "Custom Instance name"
# Ensure that "Allow PayPal enrolments" is set to "yes"
# In "Enrol cost", type in the cost of your course and in "Currency" choose your currency.
# Usually you would leave the "Assign role" as "student" unless you have a very special reason for allowing your users to enrol as, say, editing teachers etc.
# Choose an enrolment period and/or start/end dates if desired.
# Click the "Save changes" button.


*Once payment is made both the user/student and the teacher/admin should have received emails from Paypal confirming the purchase.
[[File:Paypalcoursesettings.png]]


==Changing the dollar symbol==
===What the new user sees===
The default currency symbol for Paypal is a dollar sign. If you are using GBP or Euros or another currency, you can change this by creating your own customised icon with your choice of currency. Make it 16x 16 pixels and call it ''icon.gif''  Upload your new icon via FTP to your  ''moodle directory>enrol>paypal>pix''. Your icon.gif will override the dollar sign. Make sure you refresh your page to be sure of the changes.


[[File:PaypalGBP.png]]
When a new user clicks on your course link, they will see a message inviting them to go to PayPal to purchase access to the course. In the list of courses, PayPal courses have a "P" icon next to them.
{|
| [[File:Paypaluserview.png|frame|left|Message inviting user to pay via PayPal]]
| [[File:Paypalicon.png|frame|left|PayPal course listed with "P" icon]]
|}


==Paypal capabilities==
==PayPal capabilities==


*[[Capabilities/enrol/paypal:config|Configure PayPal enrol instances]]
*[[Capabilities/enrol/paypal:config|Configure PayPal enrol instances]]
Line 68: Line 90:
*[[Capabilities/enrol/paypal:unenrolself|Unenrol self from the course]]
*[[Capabilities/enrol/paypal:unenrolself|Unenrol self from the course]]


[[fr:Inscription par Paypal]]
== See also ==
*[[Enrolment on payment]]
*[http://moodle.org/mod/forum/discuss.php?d=171745#p977221 Testing the PayPal plugin in the PayPal Sandbox]
 
[[de:Paypal-Einschreibung]]
[[de:Paypal-Einschreibung]]
 
[[es:Inscripción por Paypal]]
 
[[fr:Inscription Paypal]]
== See Also ==
*[http://moodle.org/mod/forum/discuss.php?d=171745#p977221 Testing the PayPal plugin in the PayPal Sandbox]

Latest revision as of 07:53, 7 July 2022

Note: A new recommended enrolment method for paying with PayPal is available - Enrolment on payment. Enrolment on payment provides the option of having multiple Payment gateways.


What is PayPal enrolment?

PayPal enrolment allows users to pay for courses and then be automatically enrolled.

What is the difference between PayPal enrolment and Enrolment on payment?

Enrolment on payment provides more features than PayPal enrolment, such as the option of having multiple Payment gateways.

The PayPal enrolment plugin uses PayPal's old API which still works, though PayPal encourages the use of the new API, as done for the PayPal payment gateway plugin.

PayPal enrolment can still be used but will be removed in a future version of Moodle.

For these reasons, it is recommended that you use Enrolment on payment rather than PayPal enrolment.

PayPal side setup

  1. Create a PayPal account at https://www.paypal.com
    • Although not required, it may be wise to upgrade your account to "Premier" status and get "Verified".
  2. Set the encoding to UTF-8.
    • Go to Profile > Profile and settings > My selling tools > More selling tools > PayPal button language encoding
    • Make sure you have your website's language set to Western European Languages
    • Click the "More Options" button
    • Set encoding to "UTF-8" and let the same encoding be used for IPN, too.
  3. Enable instant payment notifications (IPN)
    • Go to Profile > Profile and settings > My selling tools > Getting paid and managing my risk > Instant payment notifications > Update
    • Turn IPN on and set the notification URL to your site's enrol/paypal/ipn.php (so it reads for example like https://my.school.edu/moodle/enrol/paypal/ipn.php).

You may wish to log in to https://developer.paypal.com/developer/accounts/ and experiment with PayPal Sandbox first. If doing do, put this to your config.php:

   $CFG->usepaypalsandbox = 1;

PayPal can provide more details, but as a high-level overview you will:

  1. Create "sandbox" accounts that are used for testing. At least one "BUSINESS" account is needed, and one "PERSONAL" account is needed, to represent both sides of a pretend transaction.
  2. These sandbox accounts will be registered/associated with the developer account for your REAL PayPal business account.
  3. When testing, in addition to the configuration flag above, remember to use the "BUSINESS" type sandbox account email address in the "PayPal business email" field in the PayPal plugin settings page. Do this instead of using your REAL business email address. Failure to use the pretend business account will result in an error message.

Enabling PayPal enrolment

How to set up payment for courses

An administrator can enable PayPal file enrolment as follows:

  1. Go to Site administration > Plugins > Enrolments > Manage enrol plugins and click the eye icon opposite PayPal. When enabled, it will no longer be greyed out. Manual enrolment must also be enabled, since the PayPal plugin requires it.
  2. Click the settings link, configure as required (see details of settings below), then click the 'Save changes' button.
  • PayPal business email - This setting is case sensitive and must exactly match that in PayPal
  • Default role assignment - This means the role that a new user will automatically be given in a course when they purchase access. Usually this would be "student" unless you have a special reason for choosing another role. As for other default settings, it may be overridden in individual courses.

Tip: If you wish to allow users to create their own accounts on your site then you need to set up Email based self registration.

Course settings for PayPal

Checking you have PayPal in your course

  1. If you are using the Boost theme, from Course administration, click Participants and from the dropdown select Enrolment methods. If you are using a different theme, go to Course administration > Users > Enrolment methods
  2. If you do not see PayPal, use the pull down menu "Add method" and select PayPal. If you are a course teacher, your admin will need to allow you the capability enrol/paypal:config in order for you to add this method.
  3. Make sure PayPal has its "eye" opened:

Paypalenrolmentmethod.png

Note: Make sure you don't have Self enrolment enabled as this would allow users to access the course without paying. If you do need some users to self enrol for free, then add an Enrolment key in the self enrolment settings.


Setting a price for your course

  1. In Course Administration > Users > Enrolment methods, click the edit/hand/pen icon to the right of the PayPal option.
  2. Optional: Give a name to this enrolment method if you wish in "Custom Instance name"
  3. Ensure that "Allow PayPal enrolments" is set to "yes"
  4. In "Enrol cost", type in the cost of your course and in "Currency" choose your currency.
  5. Usually you would leave the "Assign role" as "student" unless you have a very special reason for allowing your users to enrol as, say, editing teachers etc.
  6. Choose an enrolment period and/or start/end dates if desired.
  7. Click the "Save changes" button.

Paypalcoursesettings.png

What the new user sees

When a new user clicks on your course link, they will see a message inviting them to go to PayPal to purchase access to the course. In the list of courses, PayPal courses have a "P" icon next to them.

Message inviting user to pay via PayPal
PayPal course listed with "P" icon

PayPal capabilities

See also