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:

Troubleshooting
Research
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:
Hi

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...
http://www.ad-hit.com/scripts/paypal/examples/buynow.php

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.

Thanks
This is the main variables for the buynow button...
 
/* Add variables to Form PARAMTERS MUST ADHERE TO PAYPAL STANDARDS */
$buyNow->addVar('business','paypal@webtechglobal.co.uk');	/* Payment Email */
$buyNow->addVar('cmd','_xclick');
$buyNow->addVar('amount','2.99');
$buyNow->addVar('item_name','Ad-Hit Points 500');
$buyNow->addVar('item_number','POINTS500');
$buyNow->addVar('quantity','1');
$buyNow->addVar('tax','1.99');
$buyNow->addVar('shipping','8.00');
$buyNow->addVar('currency_code','USD');
$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 */
$buyNow->addVar('notify_url','http://www.ad-hit/scripts/paypal/examples/checkpayment.php');	
/* Set URL for Thank you Page (if any) in variable */
$buyNow->addVar('return','http://www.ad-hit.com/index.php?page=pages_member/paypal_success');
 
 
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...
 
<?php
mail('admin@webtechglobal.co.uk', "TEST checkpayment Run", "checkpayment.php was accessed during this transaction");
						
/* Get Paypal Class */
require_once('../paypal.class.php');
 
/* Paypal is name of the Class */
$doCheck = new Paypal;