Solved

IPN problems

Posted on 2010-09-16
8
332 Views
Last Modified: 2012-05-10
Hi,

 

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());
0
Comment
Question by:kgp43
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:kgp43
ID: 33694352
Someone know what is causing this problem?
0
 
LVL 4

Expert Comment

by:trippy1976
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

0
 
LVL 4

Expert Comment

by:trippy1976
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.
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

Author Comment

by:kgp43
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
0
 

Accepted Solution

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

no_shipping was set to '1'
0
 
LVL 4

Expert Comment

by:trippy1976
ID: 33703531
work now then?
0
 

Author Comment

by:kgp43
ID: 33767548
sure do :)

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

Author Closing Comment

by:kgp43
ID: 34008478
I found the solution myself
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

624 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