Paypal automatic enrol problems

Paypal automatic enrol problems

by venkat lokam -
Number of replies: 5
Hi,
Here is a help request.
I moodle site students not able to enroll to the course automatically after enrolling through Paypal. But, I'm receiving payment through Paypal. I need to make the course available to students as soon as payment successful.
Help appreciated.
I'm suspecting something is needed missing in my http://..../enrol/paypal/ipn.php

After student enroll the course by payment through paypal... and click the go to enrolled course...
"Thank you for your payment! Unfortunately your payment has not yet been fully processed, and you are not yet registered to enter the course "PMP® Certification Exam Prep Course". 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"

I'm (site Admin) getting two messages
1. Notification of payment received - See contents below
2. PAYPAL ERROR: Payment pending - See contents below



1. Notification of payment received - See contents below
From : student mail id
To: my site admin id (registered in my business paypal acount under Instant Payment Notification (IPN) On
Instant Payment Notification (IPN) URL: http://..../enrol/paypal/ipn.php
Sub:Notification of payment received
Dear admin@abc.com,

You've Got Cash!

This email confirms that you have received a payment for $1.00 USD from student anme (student@hotmail.com)


-----------------------------------
Payment details
-----------------------------------

Transaction ID: 0ME820123567053C
Item Price: $1.00 USD
Total: $1.00 USD
Quantity: 1
Order Description: Certification Exam Prep Course
Item/Product Number: ABC01
The following options were included with this payment: User: Student
Buyer: Student name

----------------------------------------------------------------
Simply click the link below and complete PayPal's easy registration form to claim your money:

https://www.paypal.com/us/links/uni/email=admin@abc.com
--------
--->I can see payment if I log into my paypal business act.

2. PAYPAL ERROR: Payment pending - See contents below

- Sife sescription: Transaction failed.

Payment pending

transaction_subject => 3-13
txn_type => web_accept
payment_date => 11:32:52 Jan 31, 2009 PST
last_name => lname
option_selection1 => name
residence_country => US
pending_reason => unilateral ---- What this indicates?
item_name => Certification Exam Prep Course
payment_gross => 1.00
mc_currency => USD
payment_type => instant
protection_eligibility => Ineligible ---- What this indicates?
verify_sign => ADshkEaj5gqASpvy.X38.nDdwooKz7ADQ-iMG7KUfFL42xJt-lAkb8RYuD
payer_status => verified
tax => 0.00
payer_email => student@hotmail.com
txn_id => 0
quantity => 1
receiver_email => admin@abc.com
first_name => fname
option_name1 => User
payer_id => YGM7QYE98JAN4
item_number => ABC01
handling_amount => 0.00
payment_status => Pending ---- What this indicates?
shipping => 0.00
mc_gross => 1.00
custom => 3-13
charset => windows-1252
notify_version => 2.6
userid => 3
courseid => 13
payment_currency => USD
timeupdated => 1233430372

Thanks

Average of ratings: -
In reply to venkat lokam

Re: Paypal automatic enrol problems

by Alan Barrett -

As far as I can remember, there is a setting in Paypal (not Moodle) which says whether you want to accept paymets without approving them. If this is not set then the paymnet_status become pending. The e-mail you are getting seems to confirm this (that mail, I believe, comes from ipn.php).

Alan.

In reply to venkat lokam

Re: Paypal automatic enrol problems

by Leslie Sandoval -
Did you ever get this problem resolved?  I'm having the exact same issue...I get a PayPal error with the message that the payment is pending and the pending reason is unilateral. 
In reply to Leslie Sandoval

Re: Paypal automatic enrol problems

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);
In reply to Michael Weiland

Re: Paypal automatic enrol problems

by John Langlois -
Thanks for the information Michael.

Your code uses a secure socket layer (ssl). Is this a new requirement for IPN?
In reply to John Langlois

Re: Paypal automatic enrol problems

by Alan Barrett -

The current ipn.php code in CVS and the download for 1.9.6+ still works for me with live PayPal (the sandbox is possibly/probably a different matter) and does not require SSL or HTTP 1.1 i.e....

    $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";
    $paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com';
    $fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30);

Alan.