Ajax Poll Script
Ajax Count Down
php Infinite Scroll
URL Shortening Script
Ajax Likes Script
Text Ad Script
Fade-In Slideshow
Ajax Poll Admin
Address Book Script
Form2DB
Lead Follow-Up Database Script

PayPal IPN + e-Product Delivery Script

This script will send your e-products as email attachments to buyers upon successful PayPal Buy Now Button transaction. The script can check product information to reject e-thieves who try to get unauthorized "discounts" with bogus Buy Now buttons.

The script includes a built-in Checkout simulator that allows you to test the delivery feature without accessing PayPal.

The script can email a transaction log to the administrator on IPN handler error and/or on every run of IPN handler. It can also log transactions on the server side. No databases are used. Designed to reduce the amount of test time and maintenance efforts of e-product delivery.

Ver 1.06
NE201-106

Download

License

GPL

Demo

In this demo, you will experience the buyer's perspective using the built-in Checkout Simulator. Click the link below to start Checkout Simulator.

Checkout Simulator

Installation Guide

Quick Feedback to Tom, the developer

If you have any suggestions or find any problems, please leave them as a comment down below. we'd appreciate the feedback!

Name:
Subject:
Comment:
Email: (Will not appear online)
Posted by Silvio
2017-03-18

I was thinking that Sim Seller Email was intended only for simulation purposes.
Again thank you so much Tom, the issue is fixed! :)
Have a nice day!
Posted by Tom
2017-03-18

You are welcome!
Posted by Silvio
2017-03-17

I've made much more expensive tests and each time I found the same issue in IPN ERROR log:
result: ERROR : Invalid Seller Email: Ferry devant îlot [CProductInfoSub]
where "Ferry devant îlot" is the ... Read More
Posted by Tom
2017-03-17

>result: ERROR : Invalid Seller Email: Ferry devant îlot [CProductInfoSub]
>where "Ferry devant îlot" is the "item_name".

Maybe you changed the value of "bussiness"?
... Read More
Posted by Silvio
2017-03-02

Thank you so much Tom, this path works! :)
Posted by Tom
2017-03-03

Great!
Posted by Silvio
2017-03-01

Hi Tom,

Your script "find-path.php" running from public_html confirms the path I see, from the beginning, with FTP but when I modify the config.products.inc.php to match it, the simulator returns: ... Read More
Posted by Tom
2017-03-02

Please remove dirname(dirname(__FILE__)) . The line will be
define( 'PATH_PRODUCTS_FOLDER', '/home/silvio/products/' );
By the way, dirname(__FILE__) returns the physical path to the folder where ... Read More
Posted by Silvio
2017-02-27

Sure Tom, I can't run with browser your script "find-path.php" outside public_html so, how can I discover the path of "products" folder since the moment it is below the public_html but not the ... Read More
Posted by Tom
2017-02-28

Suppose you put "find-path.php" in the pulbic_html folder and it reports
/var/www/silvio/public_html/find-path.php
Then the physical path of public_html is
/var/www/silvio/public_html/
Posted by Silvio
2017-02-26

Thank you Tom for your script, however I only can run it from the public_html, not below.
Posted by Tom
2017-02-27

Hi,

>however I only can run it from the public_html, not below.

To make files(php, html) accessible to browsers, you have to put them on public_html or above. However, you can put data files below ... Read More
Posted by Silvio
2017-02-25

Hello Tom,

In order to protect the content of "products" folder, I've placed it on the server's root but unfortunately I can't find a working path configuration (config.products.inc.php) and the ... Read More
Posted by Tom
2017-02-26

Hi,

>unfortunately I can't find a working path configuration

You can find the path using this simple php script. Open a text editor and paste the following line:
<?php echo __FILE__; ?>
Save it ... Read More
Posted by Silvio
2017-02-18

Working perfectly, thank you again Tom!
I should add your PayPal "Donate" button :)
Posted by Tom
2017-02-19

You are welcome :)
Posted by Silvio
2017-02-17

Hi Tom,

I'm trying to customize the e-mail message with my logo but I don't know where it must be located. It's now inside the products folder, so I've added into the <body> of config.txt this line: ... Read More
Posted by Tom
2017-02-18

>src="/products/logo1.gif"

The url should start with "http://"
And the image doesn't have to be in the script folder. You can put it anywhere.
Posted by Silvio
2017-02-16

Thank you so much Tom, it was the reason!
Posted by Tom
2017-02-18

Great!
Posted by Silvio
2017-02-15

Hi Tom,

I've created a working version without accents, saved in ANSI.
Now, seeing your reply, I've saved it in UTF-8 but the simulator doesn't recognize it anymore.
Posted by Tom
2017-02-16

>I've saved it in UTF-8 but the simulator doesn't recognize it anymore.

Maybe, you saved it in UTF-8 with bom? ... Read More
Posted by Silvio
2017-02-14

Hi Tom,

The issue is fixed, I found a solution to include your full script into my page.
However I experienced again an issue with your simulator sending the e-mail message, the reason is french ... Read More
Posted by Tom
2017-02-15

>the reason is french accents that can't be used, except inside item_name (product title), what can I do?

Mails are encoded in UTF-8, so it should be able to email in any languages. You need to save ... Read More
Posted by Silvio
2017-02-09

Hi Tom,

All right, I found a little syntax error in my config, now it's working perfectly, wonderful scrypt, thank you so much Tom!
I was wondering to separate the button code from the rest of your ... Read More
Posted by Tom
2017-02-10

Hi,

>Any suggestion to run your scrypt from the button (shortest code) placed into a separate directory?

I don't understand what you meant by "placed into a separate directory." You can place it ... Read More
Posted by Silvio
2017-02-02

Hi Tom,

I'm not sure to understand your instructions (config.email.inc.php):

// If your email server requires SMTP Authentication,
// enable the following three lines, "Auth", "Username", and
// ... Read More
Posted by Tom
2017-02-03

>My smtp server requires auth. so is this syntax right?
>Auth=LOGIN
>Username=sender@xyz.com
>Password=12345

The syntax is correct. (but of course, the value may be wrong)

>Also, concerning ... Read More
Posted by Silvio
2017-01-31

Hi Tom,

Thank you so much for your script, very useful!
I've carefully followed your installation instruction and uploaded your "web" folder, keeping his original name, to the root of my domain but ... Read More
Posted by Tom
2017-02-02

Hi Silvio,

>email error: 535 Incorrect authentication data

It means the mail server couldn't authenticate you.
Please make sure the username and password you entered for the mail server in the ... Read More
Posted by Lumen
2016-11-30

Hi Tom first off; great script, Thank you!

I was wondering if it would be possible to add characteristics to the button and if so how to go about this.

I'm selling vouchers for advantures that ... Read More
Posted by Tom
2016-12-01

Hi,

>I was wondering if it would be possible to add characteristics to the button and if so how to go about this.

It's possible. Please refer to PayPal's Buy-Now Button manual because basically it ... Read More
Posted by Jerry Higgins
2016-11-10

Tom... wonderful script and it works flawlessly. Thanks so much!

Was just wondering if IPN settings on PayPal's website should be turned on (enabled)?
Posted by Tom
2016-11-11

>if IPN settings on PayPal's website should be turned on (enabled)?

Yes, it should be enabled.
Posted by Mohamad
2016-09-16

in a configuration that is useful transactions via paypal
whether the necessary configuration for config.sandbox.inc.php:

define ('SANDBOX_SELLER_EMAIL', '');
define ('SANDBOX_BUYER_EMAIL', ''); ... Read More
Posted by Tom
2016-09-17

>leave empty or needs to be set?

just leave it empty. It's for those who are testing it under PayPal sandbox.
Posted by Mohamad
2016-09-15

Thanks for the script, very helpful, we understand the instructions very easily and clearly.

but we were a little confused put string to synchronize with our website, through which the path when ... Read More
Posted by Tom
2016-09-15

Hi, You don't need to configure these
define ('SIM_BUYER_EMAIL', 'email@domain.com');
define ('SIM_BUYER_FIRST_NAME', 'John');
define ('SIM_BUYER_LAST_NAME', Last Jhon ');
They are for the ... Read More
Posted by Nick Collinson
2016-02-14

I have been successfully using v1.03. It's a very good system, easy to install and simple to use
- Do you have a changelog? Is there any point in upgrading from v1.03 to 1.06?
- Would it be easy to ... Read More
Posted by Tom
2016-02-15

Hi,

>Is there any point in upgrading from v1.03 to 1.06?

v1.06 exposes a few APIs that allow you to override the default method of loading files. If you don't plan to write code, then there is no ... Read More
Posted by traskin
2016-02-01

good but....dont work with smtp ssl or tsl
Posted by Tom
2016-02-03

Sorry, it's not compatible with TSL.
Posted by Richad
2015-10-17

I am having my website graphicarta .com for selling my images in four category how i use this script for Paypal automatic download. Please watch website and give download method for each category. ... Read More
Posted by Tom
2015-10-18

How about just creating four products?
Posted by Loris Perazzoli
2015-09-17

Hi,
your script is wonderful ad I use it since 1 year, do you know if recent change of security certificate in PayPal is compatible?
Posted by Tom
2015-09-18

Hi,

>do you know if recent change of security certificate in PayPal is compatible?

No changes are necessary in the php script. But you have to be sure that your web server is compatible with ... Read More
Posted by Kyle
2015-08-24

Thank you Tom for the reply. Basically if the simulator works locally, when you go live it should provide the customer with the same result back on the site which would show the details of the ... Read More
Posted by Tom
2015-08-25

>Basically if the simulator works locally, when you go live it should provide the customer with the same result back

That's right.
Posted by Kyle
2015-08-20

Locally the script works great and get success. However when testing with PayPal sandbox it does not send back to site or I get error about buyer and or seller. I entered the correct email ... Read More
Posted by Tom
2015-08-24

> when testing with PayPal sandbox it does not send back to site

No, the script does not work with PayPal sandbox. PayPal sandbox uses fake email addresses and so the script can't send emails.
Posted by Fred Ebony Lobos
2015-08-18

I just needed something simple to sell my documents, this was exactly what I needed. I like your approach to scripting. Simple, Functional, ergonomic, user friendly and a common sense approach to ... Read More
Posted by Tom
2015-08-19

Thank you!
Posted by Adron
2015-08-12

in the simulator i have to put in the sellers email and the buyers email if i go live hoe do i define the buyer. i assume the sellers will stay the same like the paypal email the seller gits paid at
Posted by Tom
2015-08-19

The buyer's email address is used for the simulator only. If you go live, you no longer use the buyer's email address because a real buyer will supply one.
Posted by Silvia
2015-07-28

Hi,
I think that your script really fits my needs, thank you! It's possibile to sell multiple products using paypal's chart?

Silvia
Posted by Tom
2015-07-29

Hi, sorry currently it doesn't work with paypal cart but I think that's a good idea. Thank you for your suggestion!
Posted by Fabio
2015-02-28

Ok, thank you Tom.

Fabio
Posted by Tom
2015-03-03

You are welcome :)
Posted by ysmailtest
2015-02-02

To be clear I meant a PayPal button where I could donate somthing to you for this great script.
Posted by Tom
2015-02-13

Yes, I know what you mean. Thanks for your suggestion!
Posted by Fabio
2015-02-02

Hi,
I installed your script. I uploaded the folder and when I do the Checkout Simulator I have always the same IPN problem:

IPN Result: ERROR: IPN handler did not return array:

My OS is Ubuntu ... Read More
Posted by Tom
2015-02-13

OK, this could be the PHP version issue. I'm aware that this error message appears on certain php installations but I haven't collected enough information to give you a general solution to solve it. ... Read More
Posted by ysmailtest
2015-02-01

Hi Tom, never mind found the answer, the support tech had given me the wrong server name. Great script! Do you have a donate button?
Posted by ysmailtest
2015-01-30

I get this error with the simulator. How should the email be configured to correct it?

email error: Permission denied(13) [CProductMailer]

Thanks so much
Posted by Men you this guy !!!!!
2015-01-10

good gracious, tom you make my tommy go yummi yummi and when i think of the good code your website gives to my surfing journey you make me go falling like a falling body. hmmmmmmnnnn.. such a great ... Read More
Posted by Tom
2015-01-29

You are welcome!!
Posted by Brian
2014-12-13

If I change some of the code in this to make it so site visitors can purchase multiple e-products at a time by adding them to the cart, rather than "Buy Now":

Change this:
<form name="_xclick" ... Read More
Posted by Tom
2014-12-20

>If I change some of the code in this to make it so site visitors can purchase multiple e-products at a time by adding them to the cart, rather than "Buy Now"

Sorry, they can't. The script isn't ... Read More
Posted by Aries
2014-07-20

time: 2014-07-21 01:47:02
url: http://www.multipleincom.esy.es/web/ipn/ipn.php
result: ERROR : email error: Operation now in progress(115) [CProductMailer]
=====
[CSystem:time]
-----------
2014-07-21 ... Read More
Posted by Tom
2014-07-21

Looks like the email server is not responding immediately. This isn't a simple case where I can point out the cause right away. The easiest and quickest solution is use other email servers.

If you ... Read More
Posted by Aries
2014-07-16

The error received:

result: ERROR : email error: Operation now in progress(115) [CProductMailer]
Posted by Tom
2014-07-16

Like "HTTP Error 408", the error is too weird. I think there is something wrong outside of the script. I can't say what it is without looking into it, though. I don't think you can fix it just by ... Read More
Posted by Aries
2014-07-16

Hi Tom, I tried everything was ok until I clicked the simulator pay now button. Am I missing something?


HTTP Error 408: The server timed out while waiting for your request

The server did not ... Read More
Posted by Tom
2014-07-16

>HTTP Error 408: The server timed out while waiting for your request

I suspect there is something fundamentally wrong with your web server/ php. It could be misconfigured php.ini. Anyway, I can't ... Read More
Posted by Request
2014-07-10

Hey Tom: Ya, i have fixed right now. ! damn. i was blind. i tried with everything and only not with the localhost.! at my server with cpanel from linux is localhost! so everything works now. Thanks!
Posted by Tom
2014-07-10

Great!
Posted by Request
2014-07-09

Hello Tom!

Thanks for this Script.! One Question i'm with GoDaddy. which one i need to use from the config.email.inc.php ? is that the right way? Looking forward. -
Posted by Tom
2014-07-09

For the sender's eamil address, use an email account of your domain. For example, if your domain name is www.mydomain.com, use something like info@mydomain.com.
Posted by Philip
2014-07-08

Thanks for your reply Tom. The email adress is the same. I think the problem is on the gmail server. Philip
Posted by Tom
2014-07-08

OK!
Posted by Philip
2014-07-01

Hi,
I'm French, and I need some explanation for your script.
Excuse for my language.

I have just a little question :
Is the email adress at step 2 (From=info@mydomain.com) is the same as the step 3 ... Read More
Posted by Tom
2014-07-03

Hi Philip,

>I have just a little question : Is the email adress at step 2 (From=info@mydomain.com) is the same as the step 3?

They can be the same, but not necessarily the same. Using the same ... Read More
Posted by Raman
2014-06-14

Installed several of your scripts without any trouble whatsoever. Your coding skills are of the very highest order, Tom. Many thanks.
Posted by Tom
2014-06-16

You are welcome!
Posted by Raman
2014-06-14

How can anyone not be friendly to a generous person like you, Tom? May you prosper! The downloads came through without hiccups, thanks.
Posted by Raman
2014-06-11

Download links for all the scripts fail with this error ---
Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in /home/phpkobo/public_html/oosite/sys/CDownload.class.php on line 509 ... Read More
Posted by Tom
2014-06-11

Thaaaaanks! It's nice to have friendly visitors like you ;)
Posted by giampiero
2014-06-04

by entering my email the result does not change. Php version 5.3
url simulator: http://astroamore2000.altervista.org/web/sim/index.php
Posted by Tom
2014-06-05

I PMed you.
Posted by giampiero
2014-06-03

I solved the two previous problems a) commenting on web / sim / include / CCheckoutSimulator.inc.php and comment out line 110 to suppress the error message b) on altervista.org I set the "connect ... Read More
Posted by Tom
2014-06-03

Would you send me the url of your checkout simulator?
Posted by giampiero
2014-06-03

do you know if the script works with host altervista.org
Posted by Tom
2014-06-03

Sorry, have never used the host.
Posted by giampiero
2014-06-03

ERROR:
IPN handler did not return array:

help
Posted by Tom
2014-06-03

Hi giampiero, Would you tell me your PHP version and the OS type of your web server( Windows, Linux )?
Posted by John
2014-06-02

Hi Tom

Error message is as follows:

IPN Result:

ERROR:

http response error:
Posted by Tom
2014-06-02

The error message means that the IPN handler didn't return anything. It could be due to a wrong path to the checkout simulator. Did you move the simulator folder? If you move it, you need to update ... Read More

Saturday, June 8, 2013

e-Product Delivery Script: How to send plane text emails only

By default, e-Product Delivery Script will send buyers HTML emails as well as plane text emails. If you want to force the script to send plane text emails only, you can remove the HTML section from product configuration files, or better disable it. You can disable HTML section by adding an underscore ( or any characters ) at the beginning of it like "_Html."

(example)

_Html=<<<_EOM_
<html>
<head>
.......................
.......................
.......................
.......................
</body>
</html>
_EOM_

Tuesday, January 8, 2013

e-Product Delivery Script v1.06 Update

This upgrade is for advanced users who want to set up "virtual products" in e-Product Delivery Script.

So, what are "virtual products"?

Consider the following. You have 1000 products whose product configurations (e.g. "item_name", "amount", etc ) are exactly the same except, say, the file attachment. The standard way to set up 1000 products is to create 1000 product folders and set up a product configuration file for each product.

As you can guess, it's really time comsuming and very hard to maintain. That's definitly the last thing you want to do.

Instead of creating 1000 product folders, you can set up one folder and modify the configurations on the fly. That way, you can deliver all the products without setting up product folders for each of them.

Now, we need to take a look at the code where the script obtains product configurations. Open web/ipn/sublcass/CProductInfo.inc.php in a text editor and find the following php function:

function getProductInfo( $item_number, &$pi )
{
	if ( !parent::getProductInfo( $item_number, $pi ) )
		return false;

	//-- [BEGIN] Modify the contents of $pi (ProductInfo)

	// Write your code here

	//-- [END] Modify the contents of $pi (ProductInfo)

	return true;
}

The getProductInfo function is called when the script needs to get the configurations of a product specified by $item_number, which is a product ID in PayPal terminology. The function will pack the product configurations (e.g. "item_name", "amount", etc ) into the $pi array and returns true if successful, or false otherwise.

The default implementation is that it calls parent::getProductInfo, which loads config.txt into $pi.

parent::getProductInfo works only on products that have physical product folders on the web site.

To return configurations for virtual products, which don't have any physical product folders, we need to modify a few lines of code there.

Before we proceed, let's make sure the specification of the modification.

  • The only product-001 has a physical product folder and it's config.txt is properly set up. There are no physcial folders for other products.
  • All the attachments for the products are stored in the "C:/MyAttachments/" folder. The filename of an attachment is the item_number followed by ".zip" For example, the attachment for "product-999" is "product-999.zip."

OK, here is the modified code:

function getProductInfo( $item_number, &$pi )
{
	if ( !parent::getProductInfo( "product-001", $pi ) )
		return false;

	$pi['files'] = array( "C:/MyAttachments/{$item_number}.zip" );

	return true;
}

Notice that I replaced $item_number in parent::getProductInfo with "product-001", so that parent::getProductInfo will always return the product configurations for "product-001" in the $pi array

The difference between "product-001" and other virtual products is the file path of the attachment only. All you have to do is to modify the file path stored in the $pi array.

The file path of the attachment is stored in $pi['files']. ( $pi['files'] must be an array so that it can accept multiple paths. ) The following line of code does the job.

$pi['files'] = array( "C:/MyAttachments/{$item_number}.zip" );

OK, basically, that's it.

Similarly, you can replace other items in config.txt with anything you want. Here is the list of items you can read and write:

  • $pi['item_name']
  • $pi['amount']
  • $pi['currency_code']
  • $pi['Subject']
  • $pi['Body']

Lastly, I want to point out that getProductInfo is the best place to modify if you want to load the product configurations from other sources like a database.

If you want to load all the product configurations from the database instead of the product folders, you can get rid of parent::getProductInfo because it's for loading configurations from physical product folders.

Thursday, December 20, 2012

e-Product Delivery Script v1.03 Update

"e-Product Delivery Script" was updated to v1.03. I added a description regarding enabling SMTP Authentication to web/config/config.email.inc.php Also, cleaned up line-endings of each file for Windows users.