PHP Paypal IPN Integration Class
April 19th, 2005This free PHP script provides a simple method to interface with paypal and the paypal Instant Payment Notification (IPN) system. It is not a complete system but a single PHP class allowing the PHP developer more control. Included in the zip file is a demonstration PHP script called paypal.php which shows the basic usage of the class.
This class handles the submission of an order to paypal as well as the processing an Instant Payment Notification (IPN). Including the demonstration file, the entire "paypal system" consists of just 2 PHP scripts. Once is the class and one implements the class.
Download:
paypal-1.3.0.zip
Do you like this code? Rate This Script at Hot Scripts.
If you enjoy this free PHP script and want to show your support, you can throw me a couple of bucks using paypal. Any donation, even just a buck, is always appreciated.
Version History
- v1.3.0 [10.10.2005] - Fixed it so that single quotes are handled the right way rather than simple stripping them. This was needed because the user could still put in quotes.
- v1.2.1 [06.05.2005] - Fixed typo from previous fix :)
- v1.2.0 [05.31.2005] - Added the optional ability to remove all quotes from the paypal posts. The IPN will come back invalid sometimes when quotes are used in certain fields.
- v1.1.0 [05.15.2005] - Revised the form output in the submit_paypal_post method to allow non-javascript capable browsers to provide a means of manual form submission.
- v1.0.0 [04.16.2005] - Initial Version
Resources
- Website Payments Standard Integration Guide
- Paypal Developer Support Forums
- IPN at Paypal Integration Center
Related Books
Categories
Popular Posts
RSS Feeds
Archives
September 25th, 2007 at 9:36 am
Paypal class was excellent.
If you put the payment bits back on your site.......
October 1st, 2007 at 2:07 pm
For some reason it's not letting me use other / custom fields. Any ideas?
October 1st, 2007 at 2:24 pm
It's not letting you use other custom fields? What fields are you adding? Do you mean other paypal fields as specified in the Website Payments Standard Integration Guide or your own variables which you are trying to pass through?
October 5th, 2007 at 8:53 am
I'm having trouble getting the values in a database in the case 'ipn' section.
Here is what I tried so far:
foreach ($p->ipn_data as $key => $value) { $$key == $value; }
$qry="INSERT INTO paypal_table VALUES (0 , '$payer_id', '$payment_date', '$txn_id', '$first_name', '$last_name', '$payer_email', '$payer_status', '$payment_type', '$memo', '$item_name', '$item_number', $quantity, $mc_gross, '$mc_currency', '$address_name', '".nl2br($address_street)."', '$address_city', '$address_state', '$address_zip', '$address_country', '$address_status', '$payer_business_name', '$payment_status', '$pending_reason', '$reason_code', '$txn_type')";
mysql_query($qry);
Your help is greatly appreciated.
October 5th, 2007 at 9:11 am
Since the ipn data is stored in an array in the class, you're going to do something more along the lines of:
For troubleshooting that code, you will need to log the errors. Try the debugging log that is provided with the class, or setup php.ini to log errors and check the error log.
October 5th, 2007 at 9:40 am
Thanks for getting back so quick Micah.
Looks like you had a suggestion for coding but it's not in your message?
along the lines of:....
thanks again
October 5th, 2007 at 9:43 am
Yeah... I looked at your code again and didn't see the problem. You want to send me your file via email at micahcarrick.com and I'll see if anything jumps out at me?
October 5th, 2007 at 9:44 am
My thinking is that you have empty values due to scope. But I could be wrong. I would dump the value of $qry into a text file or the error log to see what it looks like--or check PHP error log for MySQL errors.
Is *anything* getting into the database?
October 5th, 2007 at 9:58 am
There is not much that is different from your sample except instead of emailing the values I attempt the insert into the database. The emailing the values works and I get the values in the email.
Here is the complete ipn section:
if ($_GET['action'] == 'ipn')
{// Paypal is calling page for IPN validation...
// It's important to remember that paypal calling this script. There
// is no output here. This is where you validate the IPN data and if it's
// valid, update your database to signify that the user has payed. If
// you try and use an echo or printf function here it's not going to do you
// a bit of good. This is on the "backend". That is why, by default, the
// class logs all IPN data to a text file.
if ($p->validate_ipn())
{
// Payment has been recieved and IPN is verified. This is where you
// update your database to activate or process the order, or setup
// the database with the user's order details, email an administrator,
// etc. You can access a slew of information via the ipn_data() array.
// Check the paypal documentation for specifics on what information
// is available in the IPN POST variables. Basically, all the POST vars
// which paypal sends, which we send back for validation, are now stored
// in the ipn_data() array.
mysql_connect("localhost","ediblepr_dgomez","mozart123") or die("Unable to connect to database");
mysql_select_db("ediblepr_paypal") or die("Unable to select database");
foreach ($p->ipn_data as $key => $value) { $$key == $value; }
$qry="INSERT INTO paypal_table VALUES (0 , '$payer_id', '$payment_date', '$txn_id', '$first_name', '$last_name', '$payer_email', '$payer_status', '$payment_type', '$memo', '$item_name', '$item_number', $quantity, $mc_gross, '$mc_currency', '$address_name', '".nl2br($address_street)."', '$address_city', '$address_state', '$address_zip', '$address_country', '$address_status', '$payer_business_name', '$payment_status', '$pending_reason', '$reason_code', '$txn_type')";
mysql_query($qry);
}
}
October 5th, 2007 at 10:12 am
Hi
Ive written a Free digital downloads delivery script using your class. Any recommendations would be welcome.
You can check it out here
http://www.ngcoders.com/php/selling-digital-goods-with-paypal-ipn-and-php/
Thanks for the class.
October 5th, 2007 at 10:17 am
Vikas: Although I haven't downloaded it, it look cool. It's free--which is great--and it is well explained on your blog. Kudos.
October 5th, 2007 at 10:39 am
I looked at the email I received and the fields don't match what I have for the table so that was my mistake. I'll update the table and SQL and see if that fixes the problem.
thanks again
October 7th, 2007 at 8:28 am
Hi all, simple script... One question... How can currency be changed...???
October 7th, 2007 at 9:23 am
Look in the integration guide or online for a list of Paypal variables. Any of these can be set/overridden using the classes add_field() method. So, to use Canadian currency for example:
$p->add_field('mc_currency', 'CAD');
October 7th, 2007 at 10:25 pm
Micah, I have sent you a detailed mail about my problem. I am using your class with sandbox and getting txn_id as 0
Could you please tell me what the problem is ???
October 9th, 2007 at 7:49 am
I don't have time to troubleshoot your problem and I couldn't say off the top of my head why you're getting 0 as a txn_id. I suggest you post this question in the Paypal Developer Forums: http://www.paypaldev.org
October 9th, 2007 at 8:09 am
Dear Sir,
This script is very great!! It works perfect ... until when the customer's info (such as memo, Address ...) contains special characters such as (') quote, (") double quote, or (_) underscore.
Then, inside the paypal.php,
foreach ($p->ipn_data as $key => $value)
{
$body .= "\n$key: $value";
}
$body= addslashes("$body");
mail($to, $subject, $body, $headers);
the function "mail" stopped.
Please advise.
October 9th, 2007 at 8:23 am
I have seen quotes become a problem in the post back IPN data, however, I thought it was fixed in the new code (at least the problem I had seen). I don't have time to test this right now, however, you may want to post this question in the paypal developer's forums: http://www.paypaldev.org
October 9th, 2007 at 9:06 am
Thanks for your fast reply!
October 9th, 2007 at 9:31 am
very nice script worked first go! ....
October 15th, 2007 at 6:47 am
Hello,
I am using your paypal class
paypal.class.php
It works very fine, but i want to change the currency to "GBP".
i add the following line for this
$p->add_field('currency_code','GBP');
but it wont works, i write this line above the amount variable.
Please tell me that how can i use "GBP" currency
thanks
waiting for your reply
Eshban
October 15th, 2007 at 7:58 am
You may have the wrong variable. Try:
$p->add_field(’mc_currency’, ‘GBP’);
or refer to the Integration Guide for more details on which variables should be used for which type of payments.
October 20th, 2007 at 6:15 pm
I'm using your script, but the ipn case doesn't seem to be working. I'm not getting any emails with confirmation of the order or anything. The success page works and outputs all the data, but the case IPN does nothing. Is their anyway of testing whether or not it is actually working ?
October 22nd, 2007 at 9:10 am
I would guess that you're not setup properly with Paypal. Read the Website Payments Standard Integration Guide (link at the end of article above) to see how to setup the IPN. Regardless of whether you're in paypal Sandbox for testing or a live paypal account, you need to tell Paypal where to find the IPN script.
If it's still not working, make sure PHP is reporting errors to a text file and then check it for any PHP errors. You can write debugging information to this text file from within this script using something like:
trigger_error("Testpoint", E_USER_NOTICE);
Putting that towards the top of the script will tell you the script is getting called, putting it right within the IPN block will tell you it's getting called with an IPN from paypal, etc.
November 10th, 2007 at 8:19 pm
[...] PayPal IPN Integration - Micah Carrick [...]
November 11th, 2007 at 5:06 am
[...] Paypal IPN integration class: para realizar pagos desde nuestro sitio web. Sin duda muy útil para una tienda online. [...]
November 11th, 2007 at 5:51 am
[...] Paypal Payment Integration 正如你所想的那样,很多的网站尤其是商业网站会使用paypal的API把接口做在自己的网站上面(国外是这样,国内一般都是支付宝)。那么paypal IPN integration class就是一个完整的模块,使用受理时间大约为20分钟。 [...]
November 11th, 2007 at 7:01 am
[...] know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 [...]
November 11th, 2007 at 9:00 am
[...] Paypal IPN integration class, una clase php que, a través de de la API de Paypal, nos permite realizar pagos desde nuestro sitio web. [...]
November 11th, 2007 at 10:57 am
[...] know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 minutes. Editor Controls I don’t [...]
November 12th, 2007 at 2:10 pm
Hello,
Thanks again for the great IPN handler you have made available to all. I was trying to use your code and so far, it was a success.
The only problem I am having is when I try to set up a recuring payment, so that the payment happens every month.
I have tried adding the varibles listed in the IPN documentation but I was unsuccessful
$p->add_field('username', $_POST['paypalemail']);
$p->add_field('business', $owner_paypal_email);
$p->add_field('return', $this_script.'?action=success');
$p->add_field('cancel_return', $this_script.'?action=cancel');
$p->add_field('notify_url', $this_script.'?action=ipn');
$p->add_field('item_name', $item_name.$_POST['login']);
$p->add_field('amount', $price);
//MY THREE VARIABLES FOR RECURING
$p->add_field('reattempt', '1');
$p->add_field('recur_times', '1');
$p->add_field('recurring', '1');
$p->add_field('custom', $_POST['login']);
$p->submit_paypal_post();
break;
I have also tried with
$p->add_field('a3', $price);
$p->add_field('t3', 'M');
$p->add_field('src', '1');
$p->add_field('sra', '1');
But same problem, a payment is possible but no "recurring payment" is set...
Pease help me out, I have been working on it for three days now and no one on the paypal community seems to be able to help.
Sincerely,
Ali
November 16th, 2007 at 11:08 am
newbie Question,
can this script process the creditcard payment automatically, without any user intervention?
if not, is there a way to bypass the paypal front page? where you does not have to click on "Don't have a paypal account? use creditcard click here ..." and send the user directly to the billing info page ?
thanks
November 16th, 2007 at 11:25 am
RE: Dead
I'm not sure actually. Although it has been my experience that no, you cannot do that from paypal, I haven't used it in a couple years and have never used premium account or services.
November 28th, 2007 at 12:07 am
Hi,
I was reading your CLASS file. As the last transmission of data between paypal and your server I think we're suppose to send Response 200 Ok
This is the reason I was reading your class as I've alread a script that seems to be working.
Do you send the 200 ok? If so how do you do it?
I think the flow of info is Paypal ipn -> myserver -> postback all data to paypal -> verified sent from paypal to myserver (i do the checks) -> I send paypal 200ok
November 28th, 2007 at 8:48 am
Yes, you are correct. This must be something more recent than when I first wrote this class. From paypal:
"Your IPN script should then post back a 200 OK response to prevent additional attempts by PayPal to post your transaction data. If PayPal does not receive the 200 OK response from your server, PayPal will resend the notification for up to four days."
I'll make a note to update my class.
December 6th, 2007 at 6:05 pm
Micah, you never answered Ali's question, I have the same exact problem and cannot find a reasonable answer anywhere.
December 7th, 2007 at 12:57 pm
Ali and sean:
I haven't worked with recurring payments, so I'm afraid I am of no help. However, this class just passes variables to paypal the same way any other form would, so it's hard to imagine that it wouldn't theoretically work. I believe some people have had success with recurring payments, though I don't have the specifics.
December 12th, 2007 at 6:21 pm
Great script, Micah, I switched all my functions-based approach to your class pretty seamlessly.
However, I've run into a situation where everything works correctly (IPN sends email, Success outputs a Success message), but on the Success page, I am getting no values back.
It's almost as if the entire loop is being bypassed.
Any ideas why this might be?
December 12th, 2007 at 6:53 pm
To clarify, I can't figure out a way to dump the raw $_POST data from PayPal onto my success page. The for loop you've got in your example does absolutely nothing when I get spit back to the "Success" page.
Your code for the success case:
echo "SuccessThank you for your order.";
foreach ($_POST as $key => $value) {echo "$key: $value";}
echo "";
What I get back:
SuccessThank you for your order.
But I know the data is getting passed back, since I can receive emails via the ipn case that contain all the raw data parsed into table format. So I'm really at a loss.
December 16th, 2007 at 9:06 am
I have heard of this, however, I can't remember how or what causes the data not to be posted back to the success page. It's a setting in your seller account somewhere I believe... like auto-return or something.
Keep in mind, the success page and the ipn case are completely independent of one another. The success page is the page the user goes back to, the ipn page is a separate process which the paypal server requests--not the user.
December 17th, 2007 at 11:03 am
Thanks for the reply, Micah. I understand the success and ipn cases are independent of each other. However, that data that's getting passed to the ipn case exists--otherwise, the ipn actions after paypal validation (pass info into email and send) would not work.
But it's moot, I guess, since I turned auto-return off and now those values get posted to the success page! Yay! So, subquestion: I can get $key -> $value combinations from paypal on the success page now. Is there any way to put them into variables? For instance, how to I turn the output of mc_gross into $mc_gross = value;?
December 18th, 2007 at 2:06 pm
I'm not sure I understand your question. The values are coming back as $_POST data... so they're in those variables. $_POST['mc_gross'], etc.
December 26th, 2007 at 8:21 am
Paypal class was excellent.
If you put the payment bits back on your site.......
December 26th, 2007 at 7:44 pm
Hi,
Huge error showing up with this class. One person made payment, and for some reason, it seems like the IPN keeps getting triggered. They paid only one time, but 15 entries have been created over the last 2 days.
Any ideas why?
Mark
December 27th, 2007 at 10:52 am
Hey hope your holiday was great. I figured out what I was trying to do. I needed to put those values into an array and output as keyvalue variable pairs.
January 7th, 2008 at 8:17 am
Still not secured. Good job but it's not enough for me. Regards
January 23rd, 2008 at 5:15 pm
When somebody pays by eCheck the script handle it like the user makes two payments. The first one when he submits the check and the second one when it gets cleared.
January 30th, 2008 at 10:04 pm
Re: Derek Gomez's problem...
Not sure if it's still helpful, but from what I can see Derek needs to change this line:
foreach ($p->ipn_data as $key => $value) { $$key == $value; }
to this:
foreach ($p->ipn_data as $key => $value) { $$key = $value; }
Note the SINGLE equals sign instead of the double equals.
February 8th, 2008 at 1:19 pm
[...] 网站要赚钱你也要给别人提供个汇钱的接口呀,Paypal给开发者提供了良好的开发接口 paypal IPN integration class 。 [...]
February 13th, 2008 at 4:54 am
i want some help that how i can use pay pall in my website.?by using php coding
can anyone help me.
thanks for advnce
February 14th, 2008 at 1:50 pm
Great great code, excellent.
It does work for recurring payment too, the detail is that you have to change the
"$this->add_field('cmd','_xclick');" to "$this->add_field('cmd','xclick-subscription');" BUT "xclick-subscription" doesn't work when it is encrypted so the problem is not with the code, but with paypal.
What I suggest you to do is to create your own form and add return variable with the address
http://yourdomain.com/paypal.php?action=success
February 22nd, 2008 at 3:50 pm
[...] Micah Carric developed a class PHP that allows the web master to have a major control over their payments, through Paypal. It has 2 Scripts in PHP. If you want to download it or know more about it, check out the developer’s site. SHARETHIS.addEntry({ title: "Integrated payment from Paypal with PHP", url: "http://english.artegami.com/integrated-payment-from-paypal-with-php/" }); Posted in » PHP, Tricks, Web Design | [...]
March 3rd, 2008 at 10:10 pm
Hi thnx for giving nice code for payoal integration.it works but i can't insert into my databse that cunstomer information.but i am getting his firstname Test,last name user and date only.if any body knows how to send customer information to database please tell me....
March 7th, 2008 at 8:52 am
Hi,
I'm italian, i speack english so and so. I have a problem, I can't update my database in Section 'ipn'
f ($p->validate_ipn())
{
// Payment has been recieved and IPN is verified. This is where you
// update your database to activate or process the order, or setup
// the database with the user's order details, email an administrator,
// etc. You can access a slew of information via the ipn_data() array.
// Check the paypal documentation for specifics on what information
// is available in the IPN POST variables. Basically, all the POST vars
// which paypal sends, which we send back for validation, are now stored
// in the ipn_data() array.
$updateSQL = sprintf("UPDATE utenti SET stato_account='1' WHERE id='$id'");
mysql_select_db($database_data, $data);
$Result1 = mysql_query($updateSQL, $data) or die(mysql_error());
foreach ($p->ipn_data as $key => $value) { $$key == $value; }
......
}
Thanks
Matt86
March 7th, 2008 at 10:21 am
[...] Paypal IPN integration class, una clase php que, a través de de la API de Paypal, nos permite realizar pagos desde nuestro sitio web. [...]
March 8th, 2008 at 2:39 am
how to install it?
i mean , how to configure the buy now button form to work with this script?
please help !
March 12th, 2008 at 12:57 pm
Hey can you please give me an example of using the class for multiple products? I can't seemed to use:
$p->add_field('item_name1', 'White Bread');
$p->add_field('amount1', $total_amount);
$p->add_field('item_name2', 'Wheat Bread');
$p->add_field('amount2', $total_amount);
etc etc... Any help would be greatly appreciated.
March 20th, 2008 at 8:16 am
[...] Paypal IPN integration class Para realizar pagos desde nuestro sitio web. Sin duda muy útil para una tienda online. [...]
March 24th, 2008 at 9:52 am
Hi Micah,
It is really a very simple script and run in a first try.
Thanks!!!!!!!!
April 10th, 2008 at 4:59 am
HI,
I'm using your script. It's working well. I'm running the script from my localhost. The payment is done successfully but I face problem to handle ipn response.I think the line of code ### if (empty($_GET['action'])) $_GET['action'] = 'process'; ### in the script paypal.php is not working properly.
I think the variable $_GET['action'] is always empty so it's assigned by 'process' and the case 'process' is executed only. Any other case ('success','cancel' and 'ipn') is not executed so there is not any ipn response.
Is there any solution of the problem ? I'll be grateful if you please reply me. Thanks in advance.
April 10th, 2008 at 10:04 am
@Younus: I think you misunderstood how the class works.
1/ The user click the link 'Pay now' for example
2/ He is redirected to the file paypal.php (without action=anything). So in the file paypal.php, the action=process is automatically set with if (empty($_GET['action'])) $_GET['action'] = 'process'. Then the switch case structure matched the 'process' case
3/ The message 'you will be rederected...' appears and validate the form with your orders data
______________ Solution 1 _______________________
4/ Buyer pay the item and click 'Return to the store', which will get him to paypal.php?action=success as specified with $p->add_field('return', $this_script.'?action=success');
5/ PAYPAL CALLS paypal.php?action=ipn to validate the IPN (this is specified with $p->add_field('notify_url', $this_script.'?action=ipn');)
______________ Solution 2 _______________________
4/ The buyer, during the payment process, click cancel. Then he will be redirected to paypal.php?action=cancel
April 12th, 2008 at 12:39 am
Hello Micah,
your script is nice and it's working well. but i have a problem. in your script there is switch case ipn. for example when any user click on the pay button on my website and the system goes to the paypal's site. then user input the information and then submit. i think ipn works in this stage i.e. when user pay the amount then paypal notify the ipn url that the paypemt is successed. but i don't get any notification. i set the notification url in the sandbox account and also set a url in the code. so i can't update the users database in backend cause i don't get any notification.
if u help me about ipn more then it helps me a lot.
April 13th, 2008 at 7:24 am
Hi,
This is really a cool script, but the only thing that I would like to know is how can I submit multiple items in one order.
Example
My cart contains two items
product: Mobile Phone
Quantity:1
price: $23
product: book
Quantity: 2
price: $32
Any help will be highly appreciated.
Regards,
Mustafa Jalil.
April 14th, 2008 at 12:23 pm
Hey, Is it possible for this to submit a Subscription payment? I am trying to create a subscription with my order form using Paypal. Is there something that I can pass to Paypal to state that this is a subscription payment?
April 17th, 2008 at 5:30 am
Here is an example of how I got this class to support multiple items. My store was built to sell 1 shirt and 5 different sized shirts all saved in a mysql db.
// GET THE TOTAL PRICE
global $db;
$cart = $_SESSION['cart'];
$items = explode(',',$cart); // get the items from shopping cart
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$i=1;
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM shirts WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$total += $price * $qty;
// now add the multiple items to ipn checkout
$p->add_field('item_number_' . $i, $i);
$p->add_field('item_name_'.$i, $row['title'] . ' - ' . $row['size']);
$p->add_field('quantity_'.$i,$qty);
$p->add_field('amount_'.$i, $price);
$i++;
}
$total_amount = $total; // my total price
$p->add_field('cmd', '_cart'); // you need this for multiple items
$p->add_field('txn_type', 'cart'); // you need this for multiple items
$p->add_field('upload', 1);
$p->add_field('payment_gross', $total_amount);
$p->add_field('num_cart_items', $i-1);
$p->add_field('business', 'jason_1204649129_biz@towerbridgetech.com');
$p->add_field('return', $this_script.'?action=success');
$p->add_field('cancel_return', $this_script.'?action=cancel');
$p->add_field('notify_url', $this_script.'?action=ipn');
$p->add_field('currency_code', 'USD');
// the old 1 item only version
/*
$p->add_field('item_name', 'My Good Luck Shirt');
$p->add_field('quantity', $qty);
$p->add_field('amount', $price);
*/
$p->add_field('custom', $referer); // my custom field
$p->submit_paypal_post(); // submit the fields to paypal
Hopefully you can figure it out because it has been a while since I've messed with this IPN script.
Good luck!
April 22nd, 2008 at 7:10 pm
Mustafa -
This is how I add multiple items:
After you have added all your fields to field array, loop through your items as below
This code assumes your items are in array $order_items. Read on to see how to create this. You will need to change the column names ("txt_item_name") to suit your mysql table where your items are stored
$number='1';
foreach ($order_items as $item)
{
$p->add_field('item_name_'.$number, $item['txt_item_name']);
$p->add_field('amount_'.$number, $item['int_item_amount']);
$p->add_field('quantity_'.$number, $item['int_item_quantity']);
$p->add_field('shipping_'.$number, $item['int_item_shipping']);
$number++;
}
To create the array $order_items I do the following:
// sql to pull items from your cart. Obviously you will need to change this to suit
$order_recordset_items = mysql_query("select * from tbl_shopping_order_details where tbl_shopping_order_details.int_order_id = '". $this->order_id ."'");
// add each item to the array
$order_items = array();
while ($item_row = mysql_fetch_assoc($order_recordset_items))
{
$this->order_items[] = $item_row;
}
}
This assumes your items are added added to your database in your shopping cart scripts
April 22nd, 2008 at 10:56 pm
Hi Micah,
Thank you for this, it is a great help for something I have always found to be very confusing. I think I have it all set up and working correctly, but I just wanted to check...
I'm sandboxing at the moment and have created a simple form that passes "item_name" and "amount" to paypal.php. This is processed and I'm sent to Paypal, I process my payment and then click the return to merchant link and I see the success page with all the variables. I also receive an email, but on both of these pages, "payment_status" is listed as pending. Am I doing something wrong? Is there a step I'm missing, or is that email all I should receive in confirmation from Paypal? Also, is there something in your script that I can alter to have the buyer automatically returned to my site without having to click the return to merchant link?
Thanks again for making this information available.
Rory
April 22nd, 2008 at 11:27 pm
Micah has done a great job with this script. I had no problems at all integration it into my shopping cart. Most of the issues other people are having seem unrelated to the class. Do yourself a favor and read the PayPal integration guide.
This class is not a shopping cart and is not a plug and play script. You need to understand PayPal and modify the fields you are sending to suit your application.
https://www.paypalobjects.com/WEBSCR-510-20080402-1/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf
Checkout page 161 in the above PDF. It lists all the variables and when to use them.
Hope this helps some people
April 23rd, 2008 at 4:49 am
[...] check it out : http://www.micahcarrick.com/04-19-2005/php-paypal-ipn-integration-class.html [...]
April 28th, 2008 at 5:17 am
[...] know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 [...]
May 5th, 2008 at 10:00 pm
Hi Micah,
i used your code for single item i worked well, now i am working on shopping cart what changes required on the same code for multiple items plz. help me out
thanks
May 14th, 2008 at 8:04 am
Hi there,,
ok,, I may be not so coding savvy... but I don't quite get how to use your script or how to integrate it into a payment process...
Is there a file that would describe the implementation of the class a bit,, or am I missing something?
May 14th, 2008 at 4:36 pm
On my Payment for I have 3 additional fields, Domain_IP, Domain_URL and Folder,
When trying to reference these variables in the sendmail function of the IPN the variables are coming back blank. Am I doing somthing wrong?
Thanks
Gary