Catalyst-Model-PayPal-API

 view release on metacpan or  search on metacpan

lib/Catalyst/Model/PayPal/API.pm  view on Meta::CPAN


    return $self;
}

# pass stuff on through to PayPal
# we need to strip some crap but thats ok
sub AUTOLOAD {

    my $self = shift;
    my %args = @_;

    our $AUTOLOAD;

    my $program = $AUTOLOAD;
    $program =~ s/.*:://;

    # pass straight through to our paypal object

    return $self->{paypal}->$program(%args);

}

=head2 redirect_url

 $redirect = $c->model('PayPal')->redirect_url() . $token;

This is a convenient function which you can use to redirect your customer
to PayPal to make their purchases. You just concatenate their token
to the end and redirect!

This function knows about the sandbox setting, which is also very convenient
 when testing. But remember that you provide to PayPal the return URL,
so you'll need to match it with your production and testing environments
independant on your own!

=cut

sub redirect_url {

    my $self = shift;

    return 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='
      unless $self->{sandbox};

    return
'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=';

}

=head1 ERROR HANDLING

As per L<Busines::PayPal::API>, errors are in the %resp returned when functions are 
called.

=head1 SEE ALSO

L<Business::PayPal::API>

=head1 AUTHOR

Dean Hamstead, C<< <dean at fragfest.com.au> >>

=head1 BUGS

Please report any bugs or feature requests through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-PayPal-API>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

Please fork and contribute via L<https://github.com/djzort/Catalyst-Model-PayPal-API>

=head1 COPYRIGHT & LICENSE

Copyright 2012 Dean Hamstead,

This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.

=cut

1



( run in 1.178 second using v1.01-cache-2.11-cpan-364913b4093 )