I've decided using Business::PayPal::IPN, but I first need to test my
process using the paypal sandbox. I have still to setup the sandbox
properly, but in order to use it, may I assume that I have proceed the call
to:

if ($Ipn = new Business::PayPal::IPN ()) {
...
}

by something like:

$Business::PayPal::IPN::GTW = 'https://www.sandbox.paypal.com/cgi-bin/webscr
';

Jim

On 22/02/07, Jim Rey <[EMAIL PROTECTED]> wrote:

Thanks Lionel,

Shortly before you replied I managed to get through to PayPal and
apparently "pending" applied to payments via a bank account which takes 4 to
5 working days here in the UK.  During the time it takes to clear we are
going to wait for completion.  I'm going to ask PayPay if there is any way
the PayPal account can be accessed READONLY so I can check the status of
pending orders for completion, but, initially at least, we will probably
have to login to see for ourselves.

Jim

On 22/02/07, Lionel MARTIN <[EMAIL PROTECTED]> wrote:
>
>  Hi Jim,
>
> Normally, when the status is pending, Paypal sends you a new
> notification when the status becomes completed, if it ever becomes
> completed. So, from your part, dying here would just be fine. (or store data
> for your records)
>
> Lionel.
>
> ----- Original Message -----
>  *From:* Jim Rey <[EMAIL PROTECTED]>
> *To:* Alfie John <[EMAIL PROTECTED]>
> *Cc:* Mason List <mason-users@lists.sourceforge.net>
> *Sent:* Thursday, February 22, 2007 3:48 PM
> *Subject:* Re: [Mason] How do I implement PayPal IPN code in Mason?
>
> Alfie
>
> The code example shows:
>
>   my $ipn = new Business::PayPal::IPN() or die Business::PayPal::IPN->error();
>
>   # if we come this far, we're guaranteed it was a valid transaction.
>
>   if ( $ipn->completed() ) {
>
>     # means the funds are already in our paypal account.
>
>   } elsif ( $ipn->pending() ) {
>     # the payment was made to your account, but its status is still pending
>
>     # $ipn->pending() also returns the reason why it is so.
>
>
>   } elsif ( $ipn->denied() ) {
>     # the payment denied
>
>   } elsif ( $ipn->failed() ) {
>     # the payment failed
>
>   }
>
> Obviously, I won't use die because it is generally bad web practice, but
> if the returned status is pending, what do you do, resubmit at intervals
> using cron job?
>
> Jim
>
> On 22/02/07, Jim Rey <[EMAIL PROTECTED]> wrote:
> >
> > Alfie
> >
> > Thanks
> >
> > I'll check it out.
> >
> > Jim
> >
> > On 22/02/07, Alfie John <[EMAIL PROTECTED]> wrote:
> > >
> > > Hey Jim,
> > > I've used Business::PayPal::IPN in the past and found it very
> > > reliable.
> > >
> > > CPAN is your friend:
> > > http://search.cpan.org/search?query=paypal+ipn&mode=all
> > >
> > > Alfie John
> > > http://www.freehouse.com.au
> > >
> > > On 23/02/2007, at 12:30 AM, Jim Rey wrote:
> > >
> > >  Hi
> > >
> > > I have downloaded some sample code written in perl from the PayPal
> > > site, but it appears to handle the POSTed parameters directly rather like 
in
> > > CGI perl. I use mod_perl2 and Apache2 code. Does anyone have a copy of 
this
> > > code already converted for Mason2 / mod_perl2 / Apache2?
> > >
> > > Jim Rey
> > >
> > > The free code provided follows:
> > >
> > > #!/usr/bin/perl
> > >
> > > #(requires LWP::UserAgent)
> > >
> > > # 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_amount = $variable{'mc_gross'};
> > > $payment_currency = $variable{'mc_currency'};
> > > $txn_id = $variable{'txn_id'};
> > > $receiver_email = $variable{'receiver_email'};
> > > $payer_email = $variable{'payer_email'};
> > >
> > > if ($res->is_error) {
> > > # HTTP error
> > > }
> > > 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
> > > # check that $payment_amount/$payment_currency are correct
> > > # process payment
> > > }
> > > elsif ($res->content eq 'INVALID') {
> > > # log for manual investigation
> > > }
> > > else {
> > > # error
> > > }
> > > print "content-type: text/plain\n\n";
> > >
> > >
> > > --
> > > Jim Rey
> > > 48 Laburnum Park
> > > Bradshaw
> > > Bolton BL2 3BU
> > > United Kingdom
> > > Tel: 01204 593 222
> > > Mob: 07816 751 874
> > > -------------------------------------------------------------------------
> > >
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to
> > > share your
> > > opinions on IT & business topics through brief surveys-and earn cash
> > > 
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> > > Mason-users mailing list
> > > Mason-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mason-users
> > >
> > >
> > >
> >
> >
> > --
> > Jim Rey
> > 48 Laburnum Park
> > Bradshaw
> > Bolton BL2 3BU
> > United Kingdom
> > Tel: 01204 593 222
> > Mob: 07816 751 874
> >
>
>
>
> --
> Jim Rey
> 48 Laburnum Park
> Bradshaw
> Bolton BL2 3BU
> United Kingdom
> Tel: 01204 593 222
> Mob: 07816 751 874
>
> ------------------------------
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------
>
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>


--
Jim Rey
48 Laburnum Park
Bradshaw
Bolton BL2 3BU
United Kingdom
Tel: 01204 593 222
Mob: 07816 751 874




--
Jim Rey
48 Laburnum Park
Bradshaw
Bolton BL2 3BU
United Kingdom
Tel: 01204 593 222
Mob: 07816 751 874
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to