NAME

WWW::PayPal::Order - PayPal Orders v2 order entity

VERSION

version 0.001

SYNOPSIS

my $order = $pp->orders->create(...);

print $order->id, "\n";
print $order->status, "\n";           # CREATED / APPROVED / COMPLETED / ...
print $order->approve_url, "\n";      # redirect the buyer here

# After return from PayPal + capture:
print $order->payer_email, "\n";
print $order->payer_name,  "\n";
print $order->capture_id,  "\n";
print $order->fee_in_cent, "\n";

DESCRIPTION

Lightweight wrapper around the JSON returned by the PayPal Orders v2 API. Exposes the fields relevant to the common "sell a product" flow and keeps the raw data accessible via "data".

data

Raw decoded JSON from PayPal. Writable so "refresh"/"capture" can update it in place.

id

PayPal order ID.

status

Order status — one of CREATED, SAVED, APPROVED, VOIDED, COMPLETED, PAYER_ACTION_REQUIRED.

intent

CAPTURE or AUTHORIZE.

my $url = $order->link_for('approve');

Looks up a HATEOAS link by rel.

approve_url

The URL the buyer must visit to approve the payment. Returns undef once the order is captured.

capture_id

ID of the first capture attached to this order (after "capture" in WWW::PayPal::API::Orders). Pass this to "refund" in WWW::PayPal::API::Payments.

fee_in_cent

PayPal's fee for the first capture, in cents (rounded).

total

String amount from the first purchase unit, e.g. "42.00".

currency

Currency code from the first purchase unit, e.g. "EUR".

payer_email

Payer's email address (available once approved).

payer_name

Payer's full name (given_name + surname).

payer_id

PayPal-issued Payer ID.

refresh

$order->refresh;

Re-fetches the order from PayPal and updates "data" in place.

capture

$order->capture;

Captures the order (buyer must have approved it first) and updates "data".

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.