Search code examples
paypalpaypal-sandboxmoodle

Moodle Paypal_enrolment plugin not working with Paypal Sandbox?


I am using Moodle 1.9 Paypal_enrolment plugin so that to access the course student first pay the amount by paypal and then access the course.

I am following the steps given here:

http://docs.moodle.org/19/en/Paypal_enrolment

After implementing I want to test with Paypal Sanbox but facing some problem. How we can enable paypal sandbox so that I can test the flow in Paypal sandbox. Also check this link too http://moodle.org/mod/forum/discuss.php?d=171745 that elaborate similar problem as mine. Thanks


Solution

  • To enable the Paypal sandbox, you need to add the following line of code in config.php:

    $CFG->usepaypalsandbox = 'TRUE';
    

    Not sure if this has been fixed meanwhile, but you might also need to edit ipn.php to use SSL and port 443:

    $paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'ssl://www.sandbox.paypal.com';
    $fp = fsockopen ($paypaladdr, 443, $errno, $errstr, 30);
    

    More information:

    http://docs.moodle.org/dev/Enrolment_plugins#Note_about_Paypal_Sandbox