Solved

IPN problems

Posted on 2010-09-16
8
328 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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 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…

856 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