Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Paypal IPN Script Returning INVALID

Avatar of Ryan Bayne
Ryan BayneFlag for United Kingdom of Great Britain and Northern Ireland asked on
Web DevelopmentPHPE-Commerce
25 Comments1 Solution1685 ViewsLast Modified:

I've been working on Paypal IPN for a week on and off now getting no where fast really so I'm getting desperate. Right now I'm at a point where I can test my IPN script using Sandbox tool and I get INVALID response.

Or we can use Buynow button here...

and that doesnt cause a POST to my IPN script! I'll show the code for it below.

Anyone got any ideas why after the BuyNow process, confirming the transaction on Paypal, Paypal would not POST to my IPN? Once I get that sorted I will move on to figuring out why every response is INVALID.

This is the main variables for the buynow button...
$buyNow->addVar('business','paypal@webtechglobal.co.uk');	/* Payment Email */
$buyNow->addVar('item_name','Ad-Hit Points 500');
$buyNow->addVar('no_shipping','2');		/* Must provide shipping address */
$buyNow->addVar('rm','2'); /* Return method must be POST (2) for this class */
$buyNow->addVar('custom','500');/* Ad-Hit POINTS being bought */
/* Paypal IPN URL - MUST BE URL ENCODED and is the checkpayment.php file */
/* Set URL for Thank you Page (if any) in variable */
This is the top of my IPN script, checkpayment.php I have put an mail there to test its use. It only gets this far when testing through the sandbox not when using my buynow button...
mail('admin@webtechglobal.co.uk', "TEST checkpayment Run", "checkpayment.php was accessed during this transaction");
/* Get Paypal Class */
/* Paypal is name of the Class */
$doCheck = new Paypal;