Welcome Guest, Not a member yet? Register   Sign In
Trouble converting Paypal library to CI
#1

[eluser]tagawa[/eluser]
Hi. I really like Micah's revised Paypal IPN library here:
https://github.com/Quixotix/PHP-PayPal-IPN

and am trying to convert it to a CI class. I can get the original library to work, but when I try out my controller with the Paypal sandbox test tool I get "IPN delivery failed. HTTP error code 500: Internal Server Error". Going to the controller's URL directly gets the same server error (which it should), so it doesn't seem to be a syntax bug.

I'm not a CI expert (yet) so it could be something simple I've overlooked. Can anyone see anything wrong with what I've done? Thanks in advance for any help.

Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Paypal extends CI_Controller {

    function __construct() {
        parent::__construct();
    }
    
    function index() {
        $listener = new IpnListener();
        $listener->use_sandbox = true;
        
        try {
            $listener->requirePostMethod();
            $verified = $listener->processIpn();
        } catch (Exception $e) {
            mail('MY_EMAIL_ADDRESS', 'IPN error', $e->getMessage());
            exit(0);
        }

        if ($verified) {
            mail('MY_EMAIL_ADDRESS', 'Verified IPN', $listener->getTextReport());
        } else {
            mail('MY_EMAIL_ADDRESS', 'Invalid IPN', $listener->getTextReport());
        }
    }
}

class IpnListener {
    // Existing class untouched
}
?>


Messages In This Thread
Trouble converting Paypal library to CI - by El Forum - 05-09-2012, 07:55 PM
Trouble converting Paypal library to CI - by El Forum - 05-09-2012, 08:04 PM
Trouble converting Paypal library to CI - by El Forum - 05-09-2012, 10:21 PM
Trouble converting Paypal library to CI - by El Forum - 05-10-2012, 12:16 PM
Trouble converting Paypal library to CI - by El Forum - 05-12-2012, 06:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB