5, September 2008

Paypal IPN script by feha - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Paypal IPN script by feha
« previous next »
Pages: [1] Print

Author Topic: Paypal IPN script by feha  (Read 1349 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« on: Sep 15, 2006, 06:45:35 PM »

Feha,
I just found this Visit through proxy script on your site.
How much did you modify? Are you using this script on any of your sites? I'm looking for an easy way to incorporate Paypal into a new site I'm working on and the payment status will have to be added to my database so the customer can download what he paid for right after paying.


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #1 on: Sep 15, 2006, 08:37:53 PM »

I would like to know about this too.

I had made a modified version of IPN which is not working right.

I think there is a need for a good payments gateway script.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Community Supporter ?
Cyberpunk Wannabe
*
Posts: 48
336 credits
Members referred : 0


« Reply #2 on: Sep 16, 2006, 03:04:20 PM »

Hi
sorry for this but when someone else start a thread i do not get any automatic e-mails on someoneelse treads ...
Than is better to start in comments at: http://www.vision.to/CMS/Home/Comments.php?pid=301 Visit through proxy
This is a bit more enhanced version of original PayPal IPN.
As is it does not handle DB ...
There might be later some tutorial update on this, else i do paid custom work for those who needs ...

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #3 on: Sep 16, 2006, 03:11:18 PM »

So what exactly did you enhance and how do we use your script. Writing the results of the transaction to a database is something I can do if I understand how to use your script. Thanks!


Last blog : Are You Stumbling Yet?
Community Supporter ?
Cyberpunk Wannabe
*
Posts: 48
336 credits
Members referred : 0


« Reply #4 on: Sep 16, 2006, 03:36:58 PM »

here is the original:
Code:
PHP 4.1

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>
Back to top
Copmare your self ...
You get more information that you want to process with my modified version ...
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #5 on: Sep 16, 2006, 04:04:22 PM »

Oke and how do we use the script? The top says 'read the post from paypal' Is paypal sending a mail that needs to be processed or is this script being called by paypal? Please share a little bit on how to implement this sollution.


Last blog : Are You Stumbling Yet?
Community Supporter ?
Cyberpunk Wannabe
*
Posts: 48
336 credits
Members referred : 0


« Reply #6 on: Sep 16, 2006, 04:09:28 PM »

No Paypal does not send you e-mail , paypal calls your script ...

please login into your paypal account and read more how to setup your IPN
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #7 on: Sep 16, 2006, 04:12:36 PM »

oke, I'll have a look. Thanks!


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Sep 16, 2006, 05:23:06 PM »

oke, I'll have a look. Thanks!
you should also ask wineo, his integration of paypal in his directory is really "smooth"


Last blog : Is your website is down? Know before your visitors do!
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #9 on: Sep 16, 2006, 06:18:31 PM »

care to share your secrets here wineo?


Last blog : Are You Stumbling Yet?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #10 on: Sep 16, 2006, 06:33:58 PM »

Hi
sorry for this but when someone else start a thread i do not get any automatic e-mails on someoneelse treads ...

Ditto... LOL.

I will have to have a closer look at this thread and the script in question and get back to you.


Last blog : Site of the Month - August 2007
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #11 on: Sep 16, 2006, 06:53:22 PM »

Well feha is right... the PayPal documents explain it all. Though it isn't very difficult at all.

The PayPal button that you make posts the script name that you want PayPal to reply to using "notify_url". You can add GET variables to the script like this... script.php?secret=blahblah. Once the transaction is successful, PayPal notifies this script with a reply. The code above, then checks with PayPal to see if it is correct and to make sure that it is a legit transaction. If it is correct, you can then do what you like in the section of the code that has "// process payment". You can update the transaction in your database and allow the person to download their file.

I think that you should start with the default code from PayPal and work into that code what you need for your system.


Last blog : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #12 on: Sep 16, 2006, 07:11:03 PM »

Of course you can try something like this Visit through proxy Wink

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #13 on: Sep 16, 2006, 09:01:30 PM »

Of course you can try something like this Visit through proxy Wink

google bookmarked Wink


Last blog : Is your website is down? Know before your visitors do!
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #14 on: Sep 17, 2006, 02:13:36 PM »

Of course you can try something like this Visit through proxy Wink
I've downloaded that script and played with it for a bit. Looks like I've got a working paypal option on my site now!


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #15 on: Sep 17, 2006, 03:46:05 PM »

Yeah it is the most complete script for paypal, but of course it require some time to make it work

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4113
Tags : tutorials databases email Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Paypal IPN script by feha
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 05, 2008, 02:20:15 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.293
Total Topics: 7.476
Total Members: 3.897
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: FlorianHofmann

26 Guests, 3 Users online :

15 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.