Solved

IPN problems

Posted on 2010-09-16
8
324 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
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 …

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now