NAME
WWW::PayPal::Role::HTTP - HTTP + OAuth2 role for the PayPal REST API
VERSION
version 0.002
SYNOPSIS
package WWW::PayPal;
use Moo;
has client_id => ( is => 'ro' );
has secret => ( is => 'ro' );
has base_url => ( is => 'ro' );
with 'WWW::PayPal::Role::HTTP';
# Now: $self->request(POST => '/v2/checkout/orders', body => \%payload);
DESCRIPTION
HTTP + OAuth2 client-credentials role consumed by WWW::PayPal. Builds and executes JSON requests against PayPal's REST API, handling bearer-token acquisition and caching transparently. The token is cached in memory and refreshed 60 seconds before its PayPal-reported expiry.
The role requires its consumer to provide client_id, secret and base_url.
ua
The LWP::UserAgent instance used for all HTTP traffic.
access_token
Returns the current OAuth2 bearer token, fetching a new one from PayPal when missing or expired.
request
my $data = $self->request('POST', '/v2/checkout/orders', body => \%payload);
Low-level request method used by the API controllers. Accepts body, query, headers and content_type named arguments. Returns the decoded JSON response; croaks with the PayPal error message on non-2xx.
SEE ALSO
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-paypal/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.