|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/23/2003 Posts: 13 Location: ,
|
The attached perl script, that I grabbed from
the paypal web site always returns INVALID.
Also, when I print the value of $query, it's
set to: &cmd=_notify-validate
Anyone know why this would happen. I had this
all working for the last few weeks, but for some
reason, nothing works now... so I'm starting from
scratch.
I'm not a perl expert, so it may be something very
simple (at least I hope it is!).
Any ideas?
Tom
# read 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','http://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
$item_name = $variable{'item_name'};
$item_number = $variable{'item_number'};
$payment_status = $variable{'payment_status'};
$payment_gross = $variable{'payment_gross'};
$txn_id = $variable{'txn_id'};
$receiver_email = $variable{'receiver_email'};
$payer_email = $variable{'payer_email'};
if ($res->is_error) {
# HTTP error
print("\ERROR - HTTP error\n");
}
elsif ($res->content eq 'VERIFIED') {
# check the payment_status=Completed
# check that txn_id has not been previously processed
# check that receiver_email is your Primary PayPal email
# process payment
print("\nSUCCESS!!\n");
}
elsif ($res->content eq 'INVALID') {
# log for manual investigation
print("\nERROR - INVALID returned from paypal\n");
print("Query:$query \n");
}
else {
# error
print("\nERROR - error 1 \n");
}
#print "content-type: text/plain";
Tom
|
|
|
|
|
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
Your script needs to be receiving an IPN POST. Info: https://www.paypal.com/ipn
You can simulate an IPN POST: http://www.paypaldev.org/topic.asp?TOPIC_ID=1658
Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/23/2003 Posts: 13 Location: ,
|
Pat - thanks, I know you've helped me in the past too!!!
Anyway - the form you provided works. But, I'm not sure what, specifically, is wrong with mine:
Do you see whats wrong???
Tom
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <p align="center"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="admin@icepit.com"> <input type="hidden" name="payment_type" value="instant"> <input type="hidden" name="item_name" value="IcePit"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="return" value="http://www.icepit.com/cgi-bin/paypal.cgi"> <input type="hidden" name="cancel_return" value="http://www.icepit.com/ppdelmem.html"> <input type="hidden" name="image_url" value="http://www.icepit.com/images/logo.bmp"> <input type="hidden" name="currency_code" value="USD"> <input type="image" src="https://www.paypal.com/images/x-click-but20.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> <input type="hidden" name="a3" value="6.00"> <input type="hidden" name="p3" value="3"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> <input type="hidden" name="rm" value="1"> </form>
Tom
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
The sample code is oriented to payment buttons. Subscriptions works quite a bit differently and would require modifications to the code. You might consider using or at least having a look at our Password Management feature and script: http://www.paypal.com/cg...ion-pass-manual-outside
Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/23/2003 Posts: 13 Location: ,
|
But I don't want to use PayPals passwd management! I just want to use subscriptions! I'm handling passwd mgmt independently of PayPal.
I know I can do this somehow, it was working a few weeks ago....
Tom
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
I'm was just noting that the sample code does not work for subscriptions and that it might be useful to look at the perl script that we provide that does work with susbcriptions. Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/23/2003 Posts: 13 Location: ,
|
I'm confused - I don't see any other perl sample scripts for subscriptions. Where exactly can I find it??
Tom
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
Log in and got to Merchant Tools > Subscriptions > Password Management. Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/23/2003 Posts: 13 Location: ,
|
Thanks - but it looks like simply changing my rm value from 1 to 2 fixed my problem.
Tom
|
|
|
|
Rank: Starting Member
Groups:
Joined: 9/10/2009 Posts: 185
|
I think PayPal should make more note of the RM variable. It seems that is an area of confusion for many people, or they just don't know about it.
Bryan
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/13/2004 Posts: 6 Location: ,
|
Seriously, after searching for about 3 hours on this board, search engines, and another paypal dev message board site this is probably the closest I come to that has a similar problem.
Mine query is also only : &cmd=_notify-validate
And yet this thread helped me zero bit.
It seems like I'm the only one with this problem and that everyone else got it right. Can it be because I'm using a Windows machine?
ANd what about the RM value and where can I see if that is causing my problem is also???
I posted a new thread on my problem under the Perl board and after 24 hours 2 people had looked at it.
Any support will be appreciated.
Thank you, Anthony
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 2/13/2004 Posts: 109 Location: ,
|
Hi atang00, Glad to hear you got it working! (For atang00's answer, see http://www.paypaldev.com/topic.asp?TOPIC_ID=5720)Dave Burchell PayPal Technical Support PayPal, an eBay company
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 11/21/2005 Posts: 2 Location: ,
|
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by atang00 [br]Seriously, after searching for about 3 hours on this board, search engines, and another paypal dev message board site this is probably the closest I come to that has a similar problem.
Mine query is also only : &cmd=_notify-validate
And yet this thread helped me zero bit.
It seems like I'm the only one with this problem and that everyone else got it right. Can it be because I'm using a Windows machine?
ANd what about the RM value and where can I see if that is causing my problem is also???
I posted a new thread on my problem under the Perl board and after 24 hours 2 people had looked at it.
Any support will be appreciated.
Thank you, Anthony <hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 12/19/2005 Posts: 2 Location: ,
|
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by atang00 [br]Seriously, after searching for about 3 hours on this board, search engines, and another paypal dev message board site this is probably the closest I come to that has a similar problem.
Mine query is also only : &cmd=_notify-validate
And yet this thread helped me zero bit.
It seems like I'm the only one with this problem and that everyone else got it right. Can it be because I'm using a Windows machine?
ANd what about the RM value and where can I see if that is causing my problem is also???
I posted a new thread on my problem under the Perl board and after 24 hours 2 people had looked at it.
Any support will be appreciated.
Thank you, Anthony <hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
|
|
|
|
Guest
|