www.uburst.com www.uburst.com

"PayPal Perl Script?"

Go back to the LobbyClick here to Go Back to Main ListingClick here to see helpClick here to Search the Forum

General Questions
Forum Type: Public
Moderator: edmunds
Time Zone: EST
Printer Friendly Format
Original Message
 
"PayPal Perl Script?"
Posted by Chris Guth (ThomasVetDrug.com) on Sep-04-01 at 11:36 AM (EST)
Here is a PayPal Perl Script Payment Notification Handler. I don't know if this will help anyone in setting up a PayPal Interface that works with UShop.

#!/usr/local/bin/perl
# read the post from PayPal system and add 'cmd'
read (STDIN, $query, $ENV{'CONTENT_LENGTH'});
$query .= '&cmd=_notify-validate';
# post back to PayPal system to validate
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$req = new HTTP::Request 'POST','https://www.paypal.com/cgi-bin/webscr';
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);
$res = $ua->request($req);
# split posted variables into pairs
@pairs = split(/&/, $query);
$count = 0;
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$variable{$name} = $value;
$count++;
}
# assign posted variables to local variables
$receiver_email = $variable{'receiver_email'};
$item_name = $variable{'item_name'};
$item_number = $variable{'item_number'};
$custom = $variable{'custom'};
$payment_status = $variable{'payment_status'};
$payment_date = $variable{'payment_date'};
$payment_gross = $variable{'payment_gross'};
$payment_fee = $variable{'payment_fee'};
$txn_id = $variable{'txn_id'};
$first_name = $variable{'first_name'};
$last_name = $variable{'last_name'};
$address_street = $variable{'address_street'};
$address_city = $variable{'address_city'};
$address_state = $variable{'address_state'};
$address_zip = $variable{'address_zip'};
$address_country = $variable{'address_country'};
$payer_email = $variable{'payer_email'};
if ($res->content eq 'VERIFIED') {
# check transaction for uniqueness
# process payment
}
elsif ($res->content eq 'INVALID') {
# possible fraud
}
else {
# error
}

Click to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents

 Table of Contents

PayPal Perl Script?, Chris Guth (ThomasVetDrug.com), Sep-04-01, (1)

 

 
Click here to goto Click here to goto the Lobby
Messages in this discussion
 
1 . "PayPal Perl Script?"
Posted by Chris Guth (ThomasVetDrug.com) on Sep-04-01 at 11:43 AM (EST)
Here is all the info on PayPal's functions.

http://www.paypal.com/html/wa_manual_v5.0.pdf

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents


Archive This Thread: Admin and Moderator OnlyRemove This Thread: Admin and Moderator Only
Click here to goto Click here to goto the Lobby

 

 

 

 

 

 

 

 

 

 

 

 
Questions or problems regarding this bulletin board should be directed to Webmaster
©1997-1999 by DCScripts. All rights reserved.