Paypal Error

Paypal Error

by Ruben Fonseca -
Number of replies: 27

I know some people have run into this before, but I couldn't find an answer.  I setup a course with paypal, registered as a user and went through the payment process.  I was returned from paypal with the message:

Thank you for your payment! Unfortunately your payment has not yet been fully processed, and you are not yet registered to enter the course ....

The course is set to use US dollars (price of $1.00) and all the paypal info is correct.  This is a fresh install of Moodle stable as of January 5th.  I have tried this a couple of times but still run into the message above.  Thanks for any input you can give.

Ruben

Average of ratings: -
In reply to Ruben Fonseca

Re: Paypal Error

by Ruben Fonseca -

Well...

still working on this.  Do I have to set the Auto Return link in Paypal for this feature to work?

I'm making myself rich with these one dollar payments.  big grin

In reply to Ruben Fonseca

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers

Hi Ruben,

You shouldn't have to do anything in PayPal, other than set up a seller account, to have this work.  How exactly do you have your PayPal enrollment in Moodle set up?  And, do you have just the cost in the course settings or do you also have a password.  Are you working only with US$?

In reply to Chardelle Busch

Re: Paypal Error

by Ruben Fonseca -

Hi Chardelle,

I have Enrollments set to Paypal, Default enrol_cost set at 2.00, Currency set to US Dollars, my Paypal business email, and inform students/inform admins ticked.

The course itself does not have a password/enrollment key and is set to be available to students.  The enrollment period is set to unlimited, and the cost is set to 1.00. I am using US$ only.

Does the enrollment period need to be set?

Thanks for the help,

Ruben

In reply to Ruben Fonseca

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers

Hi Ruben,

No it doesn't.  I know this was an earlier bug when using GBP, but this has been fixed.  I haven't been able to replicate this, things are working for me, although I have made some code changes to my files so that a course can accept both a key or a payment.  If you want, I can send you my enrol folder and you can try loading my files and see if it works.

Chardelle

In reply to Chardelle Busch

Re: Paypal Error

by Ruben Fonseca -

Chardelle,

thanks, can you send me the folder: rfonseca at ce4techs.net

I think that I will also try another install.  As another thought, would my php.ini have anything to do with this?

thanks again for your help,

Ruben

In reply to Ruben Fonseca

Re: Paypal Error

by Ruben Fonseca -

I replaced the folder and also tried a new install to no avail.  On the new install, I turned on debugging and noticed a couple of error messages on the front page next to the course description.

Notice: Undefined property: cost in /home/ce4com/public_html/05/moodle/enrol/paypal/enrol.php on line 68

Notice: Undefined property: cost in /home/ce4com/public_html/05/moodle/enrol/paypal/enrol.php on line 71

Are these relevent to my problem?

In reply to Ruben Fonseca

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers

Hi Ruben,

Eeks, I think the code I sent you includes adding an image named cost to the course description if a course has a cost.  Try adding an icon named  cost.gif, to your theme/pix/i folder.  You can use this one here if you want.  Are you still having the original problem, though?  If so, let me know the url for the course so I can look at it.

Chardelle

Attachment cost.gif
In reply to Chardelle Busch

Re: Paypal Error

by Rich Eng -

Hi, Chardelle,

I was wondering if you would be so kind as to send me your enrolments folder like you did for Ruben (rich.eng at lionheartllc.net)  

I am trying to charge for access to certain courses on my site and would like to display a $ symbol like the one found in your cost.gif file for courses that are not free.

Much obliged,

Rich

In reply to Rich Eng

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers
Hi Rich,

I am not using this icon in my 1.5 sites, but here are the two changed files for version 1.4. If you have upgraded to 1.5, you can add this code to the 1.5 files. I have simply added an if else clause before the password clause stating that if the course has a cost, then you show the $ icon. In the course/lib.php file the added code is lines 1182-1184 (please note, however these lines will NOT be the same numbers in the 1.5 version so please place the code in the appropriate places)
and in the course/info.php files the added code is lines 51-34.

Then, you need to add the following line to your language moodle.php file, for example, lang/en/moodle.php:

$string['requirespayment'] = 'This course requires payment for access';

then add the icon to your pix/i folder
Good luck
In reply to Chardelle Busch

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers
Guess I forgot to attach the file.
In reply to Chardelle Busch

Re: Paypal Error

by Chardelle Busch -
Picture of Core developers
No--it's just that this forum is set to max 10K and its too big.  Why isn't there a message when a file is too big????????????

If you need these files, just email me.
In reply to Chardelle Busch

Re: Paypal Error

by Monica Messaggi de Souza -
I also need help and still get the message "Thank you for your payment! Unfortunately your payment has not yet been fully processed, and you are not yet registered to enter the course "Course XYZ". Please try continuing to the course in a few seconds, but if you continue to have trouble then please alert the Teacher or the site administrator"

What I did:
The installation of the Moodle itself (I tried 1.6x, 1.7x, 1.8) worked fine. I setup the enrolment plugin simply by entering the general cost, the business Paypal account and also set the default enrolment via Paypal. After that, I add the cost of course itself on the course settings. I use the Paypal sandbox as described in the documentation link in all Moodle versions.

What happens:
When the student pays for the course, the money is taken from his account, the Moodle business account receives the money taken, however the student is still not able to login. The message (as above) "Thank you for your payment! Unfortunately ...". Doesn't matter how long you wait or how many times you subscribe to the course, the money is taken and the student is not able to enter the course.

My question to you is:
once you setup the Paypal business account (either on Paypal or PaypalSandbox site) you have to make some options available on the PROFILE section to make the Paypal return to the correct page and possibly enable the Instand Payment Notification and I am thinking that I might have wrong settings.

It would be very kind if you can send/publish your settings located at the "PROFILE > Website Payment Preferences" once you are logged with your business account at Paypal. You don't need (of course) send any direct path to your site, but can you let me know, for example, if you have auto return ON, and which final path suppose to return to (/enrol/paypal/return.php? /enrol/paypal/enrol.php? other?). If you have Payment Data Transfer ON, etc...

Also on "Instant Payment Notification Preferences" should I include www.mysite.com/enrol/paypal/ipn.php address there? or you even if you have IPN switch off.

Also, as far as I can see, on Moodle documentation and implementation, the Payment Data Transfer (PDT) is NOT used (since the scripts are not passing any token as described on the Paypal documentation). Please correct me if I am wrong.

I tried many configurations and also many different setting combinations and so far nothing is working and I couldn't find any answer on the forums so far (not only me has this problem!) Please advise which version of Moodle you made it work and the settings on Moodle and on Paypal were used.

Thanks in advance,
Monica
In reply to Monica Messaggi de Souza

Re: Paypal Error

by Jason Hammes -

I am experiencing the same problem. Were you ever able to figure out a resolution?

In reply to Jason Hammes

Re: Paypal Error

by Monica Messaggi de Souza -
No, unfortunately I didn't receive any light from the forums yet; and the company is trying to find out with other programmers/consultants. Hopefully someone (or us) will have the solution soon.
In reply to Monica Messaggi de Souza

Re: Paypal Error

by Ruben Fonseca -
Monica,
We never did resolve this at our old hosting account. However, when we moved to a different provider, everything worked fine. I believe that there is something in the security of the server that prevented the passing of data back to your moodle. Our old hosting account used APF (advanced policy firewall). I don't know what our current host uses unfortunately. At any rate, I don't think this is/was a moodle issue, but rather something to do with the server.

Ruben
In reply to Ruben Fonseca

Re: Paypal Error

by Priya Saini -

hi Ruben,

I m also facing the same problem that you faced earlier. I tried enrolling to a course using the paypal method, all the steps went well but wen i m redirected to my moodle site i got the message :

Thank you for your payment! Unfortunately your payment has not yet been fully processed, and you are not yet registered to enter the course ...

Same as u got...

I checkd all the email addresses linked with it bt none received a message. It has been found that the money has been deducted from the account bt im nt enrolled in the course.

Plz help me in this concern

Thanks in advance..

waitin for reply

In reply to Priya Saini

Re: Paypal Error

by David Gammel -
Anyone have any ideas on this one? I have encountered the exact same issue with a fresh install on a Dreamhost server. What should I be looking at to trouble shoot?
In reply to David Gammel

Re: Paypal Error

by Andrew Barnes -

I'm having the same issue. Did anyone work it out yet? Anyone got any ideas on how to fix this problem?

edit: all fixed now

In reply to Andrew Barnes

Re: Paypal Error

by N Hansen -
Andrew-If you fixed it, could you please share how in case there are others with the problem?
In reply to N Hansen

Re: Paypal Error

by Mike Allen -

I have installed 1.6.4+, and have exactly the same problem.

Paypal takes the money, returns to the course, but displays the "pending" message.

The SQL database shows no entries - so it would appear I'm not receiving the reply from PayPal.

Help!

In reply to Mike Allen

Re: Paypal Error

by John Hackett -
This seems to be a recurring issue with few answers - as I've just had the same problem and fixed it I thought I'd post up my fix. Hope it helps others having a hard time getting this set up.

In my case the issue was not with Moddle at all but with the way you must set up your PayPal account which is not well documented either here on on the PayPal site itself.

The problem is that PayPal must know how to submit the information back to the moodle installation to confirm that payment has been made and received. The process is:

(1) User clicks on pay
(2) Moodle sends details to PayPal account
(3) PayPal handles the transaction
(4) PayPal returns details and a code to Moodle (This is where it breaks!)
(5) Moodle confirms details (inc. the code) with PayPal (anti-spoof...)
(6) PalPay return confirmation to Moodle
(7) Moodle enrols student

So, the problem is how to let PayPal know where to send the payment details. The moodle script handling the payments is:

http://path/to/moodle/enrol/paypal/ipn.php

You must have a premier or business PayPal account - the ordinary account does not have the facility to process instant payments. Upgrading is free so why not do it?

Then

(1) click on edit profile
(2) Go to "instant payment notification preferences" under "Selling Preferences" (if this isn't there you need to upgrade your account)
(3) click edit
(4) Check the box and put the ipn.php URL into the box
(5) save

Now, with any luck, your payments will go through correctly.

If you upgraded to Premiere then you can only accept payments from other PayPal accounts - going up to a full business account should allow you to accept payments from anyone with a email address via credit card (but I've not done this myself).

Hope this helps anyone having the same problem.
In reply to Ruben Fonseca

Re: Paypal Error

by Jeff Rader -
Picture of Plugin developers
When I upgraded from 1.8 to 1.9 my PayPal integration broke.  It was working fine and now I have the same problem that all of you are having :(

I'm going to try to setup the IPN url in the paypal settings and see if that works.
In reply to Jeff Rader

Re: Paypal Error

by Jeff Rader -
Picture of Plugin developers
The PayPal setting for the IPN was not the answer. But I did figure out my problem.

My site got hacked earlier in the month. As a result, my site was being flooded with requests from Wordpress sites for the spam pages.

In my zeal to block bad traffic, I did a mod-rewrite in my .htaccess file to deny all Wordpress user agents and all blank user agents.

It was this last part that was the problem. I was blocking the IPN request from PayPal as it comes in with a blank User-Agent.

To see if this is what is happening to you, you can try to use PayPal's IPN tester (it will tell you that your IPN request is forbidden) or you can look at your access_log. Dig into it and see if the requests for your IPN url (/enrol/paypal/ipn.php) results in 403 or 200 when it comes from PayPal. You can tell its PayPal because of the blank or "-" user agent.

That'll teach me to tighten my security smile
In reply to Jeff Rader

Re: Paypal Error

by Rob Nielson -
Jeff -

Sounds like you've done some digging around and are quite familiar with how paypal and moodle interact. Maybe you can help me out?

Unfortunately yesterday someone signed up for a course and I got an error stating that my moodle could not access PayPal to verify the transaction. Transactions before and after that one went through fine, so likely it was just some "hiccup" on the Internet.

I understand that there will be times that my site and PayPal won't be able to interact, but I absolutely NEED a way to quickly and easily manually approve a transaction when that happens.

I cannot figure out how to manually approve transactions in moodle.

So I went into the SQL tables and manually created a record in mdl_enrol_paypal and added the user, still didn't work. Added a record in mdl_role_assignments, no luck.

Where in moodle am I supposed to be able to manually approve the paypal transaction so that they can access the course?

Using moodle 1.9.

Thanks!

Rob
In reply to Rob Nielson

Re: Paypal Error

by Alan Barrett -

If the callback to ipn.php from PayPal goes missing. Your only real option is to manually assign a student role to the person in the course...

Go to the specific course. Then select from the admin menu "Assign Roles" and assign the new person the student role.

There is no need to "manually approve the transaction".

Alan.

In reply to Rob Nielson

Re: Paypal Error

by Michael Weiland -
I think something changed in PayPal's processing code. I used the code at https://www.paypaltech.com/SG2/scriptparse.php to insert into my ipn.php - and it worked:

THIS:
$header = '';
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

Replaced this:
$header = '';
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com';
$fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30);