Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


IPN problems

Posted on 2010-09-16
Medium Priority
Last Modified: 2012-05-10


I got a weird problem.

Data is being received by IPN, but only for a few of the variables.


I can only get details from the following:

$custom = $p->ipn_data['custom']; // custom field containing the User ID

$txn_id = $p->ipn_data['txn_id']; // transaction id

$txn_type = $p->ipn_data['txn_type']; // type of transaction

$payer_email = $p->ipn_data['payer_email'];

$first_name = $p->ipn_data['first_name'];

$last_name = $p->ipn_data['last_name'];


The rest does not output any details.


// Get some data
$custom = $p->ipn_data['custom']; // custom field containing the User ID
$txn_id = $p->ipn_data['txn_id']; // transaction id
$txn_type = $p->ipn_data['txn_type']; // type of transaction
$payer_email = $p->ipn_data['payer_email'];
$first_name = $p->ipn_data['first_name'];
$last_name = $p->ipn_data['last_name'];
$memo = $p->ipn_data['memo']; // Payer comment field
$payer_status = $p->ipn_data['payer_status'];
$payer_status = $p->ipn_data['payer_business_name']; // business name, if a business
// Get address info
$address_country = $p->ipn_data['address_country'];
$residence_country = $p->ipn_data['residence_country']; // country code
$address_city = $p->ipn_data['address_city'];
$address_state = $p->ipn_data['address_state'];
$address_street = $p->ipn_data['address_street'];
$address_zip = $p->ipn_data['address_zip'];
$contact_phone = $p->ipn_data['contact_phone'];
$address_status = $p->ipn_data['address_status'];
// Get payment info
$mc_gross = $p->ipn_data['mc_gross']; // Total payment received, minus fee
$mc_fee = $p->ipn_data['mc_fee']; // The fee of the transaction



//Create transaction entry in the database
mysql_query("INSERT INTO paypal_transactions (id, userid, txn_id, txn_type, payer_email, first_name, last_name, payer_business_name, address_country, address_country_code, address_city, address_state, address_street, address_zip, contact_phone, address_status, mc_gross, mc_fee, memo, payer_status, payment_date)

     values ('', '$custom', '$txn_id', '$txn_type', '$payer_email', '$first_name', '$last_name', '$payer_business_name', '$address_country', '$address_country_code', '$address_city', '$address_state', '$address_street', '$address_zip', '$contact_phone', '$address_status', '$mc_gross', '$mc_fee', '$memo', '$payer_status', '$current_time')") or die(mysql_error());
Question by:kgp43
  • 5
  • 3

Author Comment

ID: 33694352
Someone know what is causing this problem?

Expert Comment

ID: 33695460
When I hit IPN trouble, I for a foreach and output the keys I'm getting from PayPal.

Are you getting these from Sandbox or live?  What kind of payments are you accepting?

$myFile = "text.txt";
$fh = fopen($myFile, 'a');

fwrite($fh, "PROCESSING:\n");

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";

fwrite($fh, "[".$value."] [".$key."]\n");

fwrite($fh, "-------------------------\n\n");

Open in new window


Expert Comment

ID: 33695484
btw, it looks like you're working in something that is using its own IPN class kind of thing.  I have no idea how the "p" variable gets populated by that class, but I'd look at that closely too.  Maybe it's only partially implemented or has a break before you get all the good stuff.

If this is a direct IPN call, you should get the data back from PayPal as a $_POST var in my experience.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 33696229
Seems not all the variables is being send from paypal, this is from my History tab (sandbox):

mc_gross=29.00&protection_eligibility=Ineligible&payer_id=27TY9H9PEKFRS&tax=0.00&payment_date=13:27:32 Sep 16, 2010 PDT&payment_status=Completed&charset=windows-1252&first_name=Kenneth&mc_fee=1.14&notify_version=3.0&custom=51242&payer_status=unverified&business=wide_1281768914_per@domain.com&quantity=1&verify_sign=A6cwjfAc45Pa9Pu9MEJKERQReD9hAXOyaxDWtGyJHJv4rkVzohGOwmb0&payer_email=1283271282_biz@domain.com&txn_id=60X61774AS634953S&payment_type=instant&payer_business_name=Kenneth Poulsen's Test Store&last_name=Poulsen&receiver_email=wide_1281768914_per@domain.com&payment_fee=1.14&receiver_id=QZA9ATULCUGGY&txn_type=web_accept&item_name=Website Access&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=51242&payment_gross=29.00&shipping=0.00

Accepted Solution

kgp43 earned 0 total points
ID: 33703131
I found my problem

no_shipping was set to '1'

Expert Comment

ID: 33703531
work now then?

Author Comment

ID: 33767548
sure do :)

Should I just accept my own answer or is that rude?

Author Closing Comment

ID: 34008478
I found the solution myself

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question