The server requirements are as follows:
Downloading project files and configuring connect.php
To implement this PayPal IPN PHP project on your own server, follow the procedures below:
1. Download the PHP project files here: http://www.php-developer.org/wp-content/uploads/scripts/paypal_ipn_demo.zip
2. Download the MySQL IPN database tables here: http://www.php-developer.org/wp-content/uploads/scripts/ipndatabasetables.zip
3. Right click on paypal_ipn_demo.zip, and then click "Extract here."
4. Go inside the paypal_ipn_demo folder, and then open "connect.php." Add your MySQL database login credentials (username, password, hostname, database name) on connect.php. This is the database that you will use for the PayPal IPN project. Save connect.php to implement your changes.
Open "customerdownload.php" inside the paypal_ipn_demo folder. This is the download page where the customer inputs the invoice number after successfully paying with PayPal. Make the following changes:
1. Find this line:
$publickey = "YOUR_RECAPTCHA_PUBLIC_KEY";
Replace it with your own recaptcha public key. If you do not have recaptcha public and private keys, you can download it here: http://www.google.com/recaptcha
2. Find this line:
$privatekey = "YOUR_RECAPTCHA_PRIVATE_KEY";
Replace it with your own recaptcha private key.
3. Find this line:
Replace /YOUR/ABSOLUTE/SERVER_PATH_NAME with your own server path name. Read the following tutorial for details on how to get the absolute server path: http://www.php-developer.org/how-to-get-the-absolute-server-path-name-of-an-executing-script-in-php/
4. Find this line:
header('Content-Disposition: attachment; filename="http://www.yourdomain.com/paypal_ipn_demo/ebookdownloads/'.$filename.'"');
Replace http://www.yourdomain.com with your own website domain name.
5. Find this line:
Replace it with your own absolute server path. Save customerdownload.php to implement your changes.
Open the index.php file inside the paypal_ipn_demo folder. This is the shopping page in your website, where the customer shops for digital products. If they are interested in purchasing your products, they will click the PayPal Buy Now buttons. Make the following changes:
1. Find these lines of code:
Replace with your own absolute server path.
2. For the two PayPal BuyNow HTML button codes (for two ebooks: "Codex ebook" and "How to behave like a child"), find this code:
<input type="hidden" name="business" value="YOUR_PAYPAL_SECURE_MERCHANT_ACCOUNT_ID">
Replace YOUR_PAYPAL_SECURE_MERCHANT_ACCOUNT_ID with your own ID. To determine your secure merchant account ID, follow the steps below:
<input type="hidden" name="return" value="http://www.yourdomain.com/paypal_ipn_demo/customerdownload.php">
<input type="hidden" name="cancel_return" value="http://www.yourdomain.com/paypal_ipn_demo/">
Replace http://www.yourdomain.com with your domain name. You should be using https/SSL secure protocol for your download page to avoid any "unsecure mode" errors experienced by your customers from PayPal to your download page. Example, it will look like this: https://www.example.com/paypal_ipn_demo/customerdownload.php
Configure ipnhandler.php and upload the Paypal_IPN_demo folder
Open ipnhander.php inside the paypal_ipn_demo folder. This is your actual IPN handler script, which will receive and transmit the IPN message between your test server and PayPal.
1. Find this line and replace it with your own absolute server path:
2.) Find this code: $receiver_email=='YOUR_PAYPAL_SANDBOX_EMAIL@yahoo.com'
Your PayPal sandbox business email is easy to spot, because of the phrase "biz" within the email address.
That's it. You have completely configured all of the required PHP files in the PayPal IPN project. These files do NOT need to be configured, as they are included PHP files:
3. Upload the entire paypal_ipn_demo folder (that contains the configured scripts discussed previously as well as included PHP files) to the root directory of your website. For example, if your website is http://www.example.com/, the paypal_ipn_demo shopping page can be viewed in this URL: http://www.example.com/paypal_ipn_demo/ . However, do not yet open this page in the browser, as you still need to configure the MySQL database.
blog comments powered by Disqus