*****************************************************************************
PHP Paypal IPN Integration Class ****************************************************************************** Author: Micah Carrick Email: email@micahcarrick.com Website: http://www.micahcarrick.com
File: paypal.class.php Version: 1.3.0 Copyright: (c) 2005 - Micah Carrick You are free to use, distribute, and modify this software under the terms of the GNU General Public License. See the included license.txt file.
****************************************************************************** VERION HISTORY: v1.3.0 [10.10.2005] - Fixed it so that single quotes are handled the right way rather than simple stripping them. This was needed because the user could still put in quotes.
v1.2.1 [06.05.2005] - Fixed typo from previous fix :)
v1.2.0 [05.31.2005] - Added the optional ability to remove all quotes from the paypal posts. The IPN will come back invalid sometimes when quotes are used in certian fields.
v1.1.0 [05.15.2005] - Revised the form output in the submit_paypal_post method to allow non-javascript capable browsers to provide a means of manual form submission.
v1.0.0 [04.16.2005] - Initial Version
****************************************************************************** DESCRIPTION:
NOTE: See www.micahcarrick.com for the most recent version of this class along with any applicable sample files and other documentaion.
This file provides a neat and simple method to interface with paypal and The paypal Instant Payment Notification (IPN) interface. This file is NOT intended to make the paypal integration "plug 'n' play". It still requires the developer (that should be you) to understand the paypal process and know the variables you want/need to pass to paypal to achieve what you want.
This class handles the submission of an order to paypal aswell as the processing an Instant Payment Notification.
This code is based on that of the php-toolkit from paypal. I've taken the basic principals and put it in to a class so that it is a little easier--at least for me--to use. The php-toolkit can be downloaded from http://sourceforge.net/projects/paypal.
To submit an order to paypal, have your order form POST to a file with:
$p = new paypal_class; $p->add_field('business', 'somebody@domain.com'); $p->add_field('first_name', $_POST['first_name']); ... (add all your fields in the same manor) $p->submit_paypal_post();
To process an IPN, have your IPN processing file contain:
$p = new paypal_class; if ($p->validate_ipn()) { ... (IPN is verified. Details are in the ipn_data() array) }
In case you are new to paypal, here is some information to help you:
******************************************************************************
Located in /model/paypalipn.class.php (line 110)
Documentation generated on Sun, 20 Sep 2009 02:21:24 -0700 by phpDocumentor 1.4.1