# PayPal

Availability conditions ::: availability_paypal
Maintained by Daniel Neis Araujo
An Availability Condition to require a PayPal payment to access activities and resources.
Latest release:
908 sites
60 fans
Moodle 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8

## PayPal Availability Condition

With this plugin you can put a price in any course content and ask for a PayPal payment to allow access.
The person in charge to configure the enrolment method on the course will be able to configure the enrolment cost's value and currency.
The user will be able to pay in some other currency at PayPal website. The conversion rates will be calculated and applied by PayPal.

## Install

• Put these files at moodle/availability/condition/paypal/
• Follow the instructions to install the plugin
• You must set the "Return URL" at PayPal to https://YOURMOODLESITEADDRESS/availability/condition/paypal/ipn.php (this may conflict with Moodle's enrollment PayPal plugin, make sure you use separate apps if you use PayPal enrollment)
• You must activate the IPN at your PayPal account
• You must have HTTPS enabled and working on your Moodle site

## Usage

This works like the PayPal enrol plugin, but instead of restricting the full course, you can restrict individual activities, resources or sections (and you can combine it with other availability conditions, for example, to exclude some group from paying using and "or" restriction set).

For each restriction you add, you can set a business email address, cost, currency, item name and item number.

## Funding

The development of this plugin was funded by TRREE - TRAINING AND RESOURCES IN RESEARCH ETHICS EVALUATION - http://www.trree.org/

## Dev Info

Feel free to send pull requests at: https://github.com/danielneis/moodle-availability_paypal/pulls

### Awards

• Wed, Jul 1, 2020, 4:45 AM
Hello, I appreciate the developer's work, this latest version fixes the error that I was marking, I could already test a payment, but it does not redirect me or give me access to the activity that I paid, I do not know if it is because they pay with my paypal user which is a different email than my moodle user.

sorry my english, I used a translator

thanks and regards
• Thu, Jul 2, 2020, 12:56 AM
I just did another test, I already made a payment with the same email as my moodle user and after making the payment in paypal, it does not redirect me or give me access to the activity I paid for ... greetings and thanks
• Thu, Jul 2, 2020, 4:36 AM
Hi Jonathan

On my site, after the payment on PayPal, it redirects to the PayPal page of the plugin (where the price and the send payment button are shown).

If that is the case for you, I think it is normal behaviour. The course navigation or breadcrumb can be used.

Myself I think I'll look at adding a button to return to the course (doable with a bit of JavaScript).

Regards
Matt
• Thu, Jul 2, 2020, 9:47 AM
hello, indeed it happens to me the same, after making the payment in paypal, it takes me to the page of moodle where it puts the price and the paypal button, but it does not give me access to the activity or section that I paid, thanks for your help, best regards
• Sun, Jul 12, 2020, 2:44 PM
Hello and thank you for this plugin.
testing this plugin, I found it to successfully enrol a user and collect payment.
I used it to test a limited time access to a course, and found that regardless of which "Enrolment expiry action" I select ( I tried all three), one the user purchases access and the time expires, that enrolment option is no longer available for them.
For example, I would like the option for a user to pay a small fee for a 1 day access, after which they can re-purchase the 1 day access as needed. The first time they do this, it works well, however after this, the PayPal option is no longer available for them. I would have thought was the case if "Disable Course Enrolment, and remove roles" was selected, but even when I select " Unenroll User from Course" or "Keep user enrolled", the PayPal purchase is no longer available after the user purchases it once.
Is there a solution to this please?
Kind regards,
Joe
• Wed, Jul 15, 2020, 8:52 PM
Hi, Joe Molnar

this plugin here is an availability condition, to restrict access to individual activities or course sections, it's after user enrollment.
The user enrollment using PayPal is a core feature. You must ask about it on the General Developers Forum.
• Wed, Jul 15, 2020, 8:58 PM
For those with problems with redirects, please review your configuration on PayPal website and look if you followed the instructions correctly.
• Thu, Jul 16, 2020, 3:55 AM
Hello and thank you for the updated plugin. We just got this setup and working with PayPal's sandbox as we don't want to submit actual transactions. I have two questions,

1) how are the restriction managed? and how can it be removed from an individual that has purchased access to an activity. With the course based PayPal enrollment, unenrolling makes the user repurchase the course. Just wanting to know how to address possible transaction issues that can happen when a paid customer proves they paid via their invoice but access was not granted. How does one manually grant them access to the restricted activity?
2) When the PayPal form is presented, I was able to update the cost of the item using my browsers developer tools. I can change the cost of a $300 course down to$1 by updating a single form field. PayPal accepted the payment and it seams like there was no validating of form tampering. Hope can this be prevented?
• Fri, Sep 11, 2020, 12:07 AM
hello Vincenzo

Could you solve your doubts? I have the same questions
• Thu, Oct 1, 2020, 4:35 AM
Is it possible to set payment per theme instead of full course?
• Sun, Oct 4, 2020, 10:34 PM
Is there anyway to add subscription/recurrent payments in the plugin?

I have a course where users pay a subscription in monthly basis.
Paypal allows to set up subscription/recurrent payments. Is it possible to integrate this on your plugin? If not, are you thinking on integrate it in the near future?

Thanks for the great plugin and kind regards
• Tue, Nov 10, 2020, 5:47 AM
Hello, does anyone have an answer to Vicenzo's questions
• Tue, Dec 22, 2020, 4:05 AM
Hi, thanks for developing this plugin.

I have a problem when I use the plugin on different sections of the same course. Even if I set different item name, item number and price, if I unlock one section, it automatically unlocks the others as well. For payments I use the same paypal account.

my version of moodle is 3.6.3 and I use version 11 (2020072100) of the plugin
• Fri, Mar 5, 2021, 3:22 AM
Hello,

I just made available a version that checks for the amount paid to be equal the cost defined.

It's not possible to set payment per theme.

If you want to manually add users to access the activity you should create a group, add the user as member, add a group restriction to the activity and configure to make a payment OR belong to group.

I'll check the issue with the sections and let you know.
• Fri, Mar 5, 2021, 6:08 PM
Hi Daniel

Thanks for the update. That's great news.

Regards
Matt