All in one forum  - Applications | Games | E-Books | Music, Movies & Videos | Mobile Stuff | Live Discussions | Webmaster Stuff | Many More | Community to Hang Out and Stick to
Search Today's Posts Mark Forums Read

Go Back   Home > Tutorial Section > Programming > PHP
Reload this Page [Tutorial] Easy payments using Paypal IPN
Forgot Password? Join Us!
PHP Post your Personal Home Pages Programing Tutorial Here

Notices
Your link here Your link here Your link here Your link here Your link here

Your Ad Here


Rate This Thread - Easy payments using Paypal IPN.

Post New Thread Reply
Bookmarks
 
LinkBack Thread Tools Display Modes
Old 06-13-2008, 05:32 AM   #1 (permalink)
 
KoOL's Avatar
 
User Info
Join Date: Oct 2007
Location: In You Mind
Age: 26
Achievements Posts: 10,299
Casino Cash: $1072020

Total Points: 236,852,801,669.43
Donate

Reputation: 92643
KoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond reputeKoOL has a reputation beyond repute


Awards Showcase
Administrator Of the Month Of Jan 
Total Awards: 1
Easy payments using Paypal IPN

There are several PHP scripts and classes to process PayPal payments using their native IPN (Internet payment notification) feature. Because the whole process is based on the data you need to send via a web form to the PayPal payment processor these script look very similar.
The payment / notification process is shown via the following graphic:

Inside the form there are several required values to process a payment. PayPal gives the advice to post them all to get everything working. The following variables get some special attention:
Quote:
business
Quote:
= your PayPal email address
cmd = single payments or subscription service (_xclick or _xclick-subscriptions)
return = the URL where the buyer get back after the payment is processed
cancel_return = the URL where the buyer get back if he has cancelled the payment
notify_url = the location where your IPN script is located
rm = how you need the data submitted from PayPal to your IPN script (1=get, 2=post)
currency_code = the currency you accept for your payment
lc = the country version of PayPal where your buyer is send to
There are much more variables, but we think that the other variables (product, order and shipment information) speak for themselves. Find a complete form provided with the example files.
To run some IPN enabled payment process we need a small script which will double check if the data which is send to the IPN script is valid according the data which is stored on the PayPal server. This feature is very important if your e-commerce accepts automatic payments.
The following code is able to check if the payment is valid against the PayPal server. Use this test to decide if the payment is valid or not.
HTML Code:
<?php
$url = ‘https://www.paypal.com/cgi-bin/webscr’;
$postdata = ”;
foreach($_POST as $i =&gt; $v) {
$postdata .= $i.‘=’.urlencode($v).‘&amp;’;
}
$postdata .= ‘cmd=_notify-validate’; $web = parse_url($url);
if ($web[’scheme’] == ‘https’) {
$web[‘port’] = 443;
$ssl = ’ssl://’;
} else {
$web[‘port’] = 80;
$ssl = ”;
}
$fp = @fsockopen($ssl.$web[‘host’], $web[‘port’], $errnum, $errstr, 30); if (!
$fp) {
echo $errnum.‘: ’.$errstr;
} else {
fputs($fp, “POST ”.$web[‘path’].“ HTTP/1.1rn”);
fputs($fp, “Host: ”.$web[‘host’].“rn”);
fputs($fp, “Content-type: application/x-www-form-urlencodedrn”);
fputs($fp, “Content-length: ”.strlen($postdata).“rn”);
fputs($fp, “Connection: closernrn”);
fputs($fp, $postdata . “rnrn”); while(!
feof($fp)) {
$info[] = @fgets($fp, 1024);
}
fclose($fp);
$info = implode(‘,’, $info);
if (eregi(‘VERIFIED’, $info)) {
// yes valid, f.e. change payment status
} else {
// invalid, log error or something
}
}

?>
</span>


For Download Links U need to Press Thanks Button
My Goal 2: (Complete 10000)

Please don't PM me For Posts, Request and Not Working Threads. Use Button.
KoOL is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply
Click here to Donate to remove the Adverts.
Your Ad Here
Post New Thread Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with paypal!!!! peecko03 Hacking Request 0 04-26-2008 05:40 PM
Paypal Shop Maker 3.0 devilboyz Appz Zone 0 02-13-2008 06:33 AM
Paypal Easy donate installed... Admins Rules, Announcement And News 0 05-03-2007 12:59 PM



Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles

RapidShare Links PhazeDDL Warez
PhazeDDL Warez