NAME

WWW::PayPal::Subscription - PayPal Billing Subscription entity

VERSION

version 0.001

SYNOPSIS

my $sub = $pp->subscriptions->create(plan_id => $plan_id, ...);

print $sub->id;
print $sub->status;            # APPROVAL_PENDING / ACTIVE / SUSPENDED / CANCELLED / EXPIRED
print $sub->approve_url;       # redirect the buyer here

# ... after approval ...
$sub->refresh;
print $sub->status;            # ACTIVE
print $sub->subscriber_email;
print $sub->subscriber_name;
print $sub->next_billing_time;
print $sub->last_payment_amount, ' ', $sub->last_payment_currency;

$sub->suspend(reason => 'User paused');
$sub->activate(reason => 'Resumed');
$sub->cancel(reason  => 'User cancelled');

DESCRIPTION

Wrapper around a PayPal Billing Subscription JSON object. A subscription is the per-user, recurring-payment binding between a buyer and a plan. Once the buyer approves it at "approve_url", PayPal auto-bills them on the plan's schedule.

data

Raw decoded JSON for the subscription.

id

Subscription ID (e.g. I-XXX...).

status

APPROVAL_PENDING, APPROVED, ACTIVE, SUSPENDED, CANCELLED or EXPIRED.

plan_id

ID of the billing plan backing this subscription.

custom_id

Merchant-supplied reference (e.g. your internal user/account ID).

start_time

create_time

update_time

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

Looks up a HATEOAS link by rel.

approve_url

URL the buyer must visit to approve the subscription. Only meaningful while status is APPROVAL_PENDING.

subscriber_email

subscriber_name

given_name + surname.

subscriber_payer_id

next_billing_time

ISO-8601 timestamp of PayPal's next billing attempt, e.g. 2026-05-15T10:00:00Z.

last_payment_amount

String amount of the most recent successful payment.

last_payment_currency

Currency code of the most recent successful payment.

cycle_executions

Raw ArrayRef describing how many cycles have executed in each tenure (TRIAL, REGULAR).

refresh

suspend

activate

cancel

$sub->suspend(reason => 'holiday');
$sub->activate(reason => 'back');
$sub->cancel(reason  => 'user quit');

Lifecycle actions that also "refresh" the local data afterwards.

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.