PayPal IPN Class

Using PayPal for online payments

API Documentation
Download
  • PHP Source Code
  • PHP Source and documentation (zip file)
  • [adv]

    PayPal.php is a PayPal IPN (Instant Payment Notification) package done in an object oriented manner. It is a generic interface to PayPal's IPN interface.

    The basic idea is to extend the class with your own methods such as status_completed() or check_txn_id() where you can focus on how an IPN would relate to your application rather than focusing on the details of PayPal.

    This package is used in PayVeX for selling content online and GenieGate for selling online memberships.

    Alternatively, if this class isn't your style, you could try an another popular approach to paypal integration.

    
    require_once("PayPal.php");
    
    class My_IPN_Handler extends PayPal {
    
    	function status_completed(){
    		// Do whatever you need to do to finish 
    		// a transaction.
    	}
    	function check_email($email) {
    		// Make sure $email is MY email.
    	}
    	// .. other methods as required ..
    }
    $paypal = new My_IPN_Handler(); // Your constructor
    
    // Call any other methods, set up databases, etc..
    // Then call processIPN() to actually deal with PayPal's IPN. 
    $errcd = $paypal->processIPN();
    if($errcd){
    	// Error occured, Log the error, do anything else to cleanup.
    	error_log($paypal->errstr($errcd));
    }else{
    	//Everything went smoothly
    }
    

    The PayPal class has support for debugging and testing, it is possible to do most of your tests without actually contacting the paypal web site.

    Questions, comments or requests? Contact us

    The PHP Resource Index