Solved

IPN problems

Posted on 2010-09-16
8
329 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
Technology Partners: 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!

 

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

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 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