Subscription lifecycle
Statuses, trials, renewals, failed payments, plan changes, cancellation and pausing for PayPal subscriptions, and how each one affects access.
Recurring prices become PayPal billing plans in your own PayPal account (how PayPal subscriptions work). PayPal charges on schedule; ExtensionBill follows PayPal’s webhooks, keeps a subscription record in sync and turns it into an entitlement. Read this page when you sell recurring prices and want to know how each event affects access and what to show in your extension.
approval_pending ──approve──▶ active ──payment fails──▶ past_due ──threshold──▶ suspended or canceled
▲ │ │
│ └──pause──▶ suspended └──payment succeeds──▶ active
└─────resume─────┘
active, past_due or suspended ──cancel──▶ canceled (final)
active ──plan completes──▶ expired (final)
Statuses
| Status | What it means | Access |
|---|---|---|
approval_pending | Checkout started, not yet approved in PayPal. | None |
active | Billing normally, including during a free trial. | Granted. With a scheduled cancellation, until cancelAt. |
past_due | A renewal failed; PayPal keeps retrying. | Kept for the grace period (graceDays, default 7), then ends |
suspended | Paused by you, by the customer (if allowed) or by PayPal after too many failures. | Off. After a dunning suspension, ends when the grace period runs out. |
canceled | Future billing stopped. | Until cancelAt (end of the paid period), or at once with Cancel immediately. After a dunning cancellation, until the grace period ends. |
expired | The plan completed. | None |
Transitions
| From | Event | To |
|---|---|---|
approval_pending | Buyer approves, BILLING.SUBSCRIPTION.ACTIVATED | active |
active | BILLING.SUBSCRIPTION.PAYMENT.FAILED | past_due |
past_due | Next PAYMENT.SALE.COMPLETED | active |
past_due | Failure threshold reached, BILLING.SUBSCRIPTION.SUSPENDED or CANCELLED | suspended / canceled (canceledBy: dunning) |
active / past_due | You or the customer suspend | suspended |
suspended | You or the customer resume, BILLING.SUBSCRIPTION.RE-ACTIVATED | active |
active / past_due / suspended | Cancel (customer, merchant or PayPal) | canceled |
active | BILLING.SUBSCRIPTION.EXPIRED | expired |
canceled and expired are final. To come back, the customer starts a new checkout.
Signup
The buyer uses the same hosted checkout as a one-time purchase, with a PayPal Subscribe button. On approval the subscription activates, the entitlement is granted and you receive subscription.created and subscription.activated.
Three price options shape the first cycles:
- Free trial (
trialDays): a zero-priced trial cycle on the PayPal plan. The subscription isactivewith full access;subscription.trialEndsAtis the first charge date. This is separate from the install trial inUserState.trial(Free trials). - Setup fee (
setupFee): charged on approval. Plans usesetup_fee_failure_action: CANCEL, so if it can’t be collected, PayPal cancels the subscription and no access is granted. - Discount codes: a
oncediscount reduces only the first period (a paid trial cycle at the discounted price). Aforeverdiscount overrides the plan price for every regular cycle (Discount codes).
Tax on subscriptions is set on the PayPal plan (Taxes).
Renewals
On each collected payment PayPal sends PAYMENT.SALE.COMPLETED, and ExtensionBill:
- Creates a renewal order linked to the subscription, with the PayPal sale ID as capture ID, plus the PayPal fee and net amount.
- Emails a receipt (Settings → Emails → Receipts).
- Advances
currentPeriodEndto PayPal’sbilling_info.next_billing_time. - Resets the failed-payment counter and moves
past_dueback toactive. - Sends
subscription.renewedandorder.paid.
Renewal reminders: for plans billed every 3 months or more, the customer gets an email 7 days before renewal, once per period, with a link to the customer portal where they can cancel. On by default; turn it off with Renewal reminders in Settings → Emails (emails.renewalReminders).
Failed payments and dunning
Configure dunning per app in Settings → Checkout:
| Setting | Values | Default | Effect |
|---|---|---|---|
failureThreshold | 1, 2 or 3 | 3 | The plan’s payment_failure_threshold: failed payments PayPal tolerates before suspending. |
graceDays | days | 7 | How long a past_due customer keeps access after the first failure. |
Plans use auto_bill_outstanding: true, so PayPal adds any unpaid amount to the next attempt.
-
PayPal sends
BILLING.SUBSCRIPTION.PAYMENT.FAILED. The subscription becomespast_due,pastDueSinceis set and you receivesubscription.payment_failed. -
The customer gets a payment-failed email (Settings → Emails → Payment failed) linking to their PayPal automatic payments page (
paypal.com/myaccount/autopay, or the sandbox equivalent) to update the funding source, and to your customer portal. -
PayPal retries on its own schedule. A later success returns the subscription to
active. -
If failures reach your threshold, PayPal suspends or cancels it. ExtensionBill records
canceledBy: dunning, and access ends when the grace period (pastDueSince+graceDays) runs out.
To step in, open the subscription and click Retry outstanding balance: PayPal charges the outstanding amount right away. Showing the past_due state in your extension recovers revenue that PayPal’s retries miss; customers usually fix the payment method within minutes.
Upgrades, downgrades and interval changes
A subscription can move to another recurring price, in the same product (monthly to yearly) or another one (Basic to Pro):
- Dashboard: Subscriptions → open the subscription → Change price.
- Customer portal: when Allow plan change is on (
portal.allowPlanChange, on by default). See Customer portal.
ExtensionBill asks PayPal to revise the subscription with the new price’s plan. If PayPal requires the buyer’s approval, ExtensionBill returns an approval link: the portal sends the customer there; from the dashboard, you send it to them. Until PayPal confirms with BILLING.SUBSCRIPTION.UPDATED, the new price is stored as pendingPriceId and access stays unchanged.
On confirmation the entitlement switches to the new product, the customer gets a plan-changed email and you receive subscription.updated. When and how much PayPal charges follows PayPal’s revise behavior.
Moving between a subscription and a one-time price is not a plan change; it takes a new checkout.
Cancellation
Who can cancel:
- The customer, in the customer portal (
bill.openPortal()), when Allow cancel is on (portal.allowCancel, on by default). - You, in Subscriptions → open the subscription → Cancel. Choose Cancel immediately to also end the entitlement right away (for abuse, or with a full refund).
- PayPal or the buyer directly, for example from their PayPal account (
BILLING.SUBSCRIPTION.CANCELLED).
ExtensionBill then:
- Cancels it at PayPal, so no future payments are taken.
- Sets
cancelAttocurrentPeriodEnd: access lasts until the end of the paid period. - Emails the customer (Settings → Emails → Cancellations).
- Sends
subscription.canceledwithcanceledBy:customer,merchant,paypalordunning.
A canceled subscription can’t be reactivated. To come back, the customer subscribes again through a new checkout; the portal says so, and your paywall can just call bill.openCheckout().
Pause and resume
In the dashboard, Suspend pauses and Activate resumes (PayPal’s suspend and activate endpoints):
- While suspended, PayPal doesn’t bill and the entitlement is off.
- On resume, billing continues and access returns.
- You receive
subscription.suspendedon pause andsubscription.activatedon resume.
Customers can pause from the portal only if you turn on Allow pause (portal.allowPause, off by default).
Expiration
When a plan finishes (BILLING.SUBSCRIPTION.EXPIRED), the subscription becomes expired, access ends and you receive subscription.expired and entitlement.revoked.
Reading it in your extension
UserState.subscription describes the subscription linked to this install:
type UserSubscription = {
id: string
status: 'approval_pending' | 'active' | 'past_due' | 'suspended' | 'canceled' | 'expired'
currentPeriodEnd: string | null // next billing date (ISO)
cancelAt: string | null // access ends at this date when a cancellation is scheduled
trialEndsAt: string | null // end of the PayPal free trial, if any
} | null
| Situation | status | currentPeriodEnd | cancelAt | paid |
|---|---|---|---|---|
| In free trial | active | first charge date | null | true |
| Renewing normally | active | next renewal | null | true |
| Canceled, period not over | canceled | end of period | end of period | true |
| Payment failed, in grace | past_due | due date | null | true |
| Grace period over | past_due / suspended / canceled | as last known | as set | false |
| Paused | suspended | as last known | null | false |
| Ended | canceled / expired | as last known | past date | false |
paid and entitlements come from active entitlements, so bill.hasAccess(user) is always the right gate. Use subscription only for messaging, for example a status line under the plan name:
// popup.js
import { bill } from './bill.js'
const formatDate = (iso) =>
new Date(iso).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })
function subscriptionLine(user) {
const sub = user.subscription
if (!sub) return ''
switch (sub.status) {
case 'active':
if (sub.cancelAt) return `Ends on ${formatDate(sub.cancelAt)}`
if (sub.trialEndsAt && new Date(sub.trialEndsAt) > new Date()) {
return `Free trial until ${formatDate(sub.trialEndsAt)}`
}
return sub.currentPeriodEnd ? `Renews on ${formatDate(sub.currentPeriodEnd)}` : 'Active'
case 'past_due':
return 'Payment failed. Update your payment method in PayPal to keep access.'
case 'canceled':
return sub.cancelAt && new Date(sub.cancelAt) > new Date()
? `Ends on ${formatDate(sub.cancelAt)}`
: 'Subscription ended'
case 'suspended':
return 'Subscription paused'
case 'expired':
return 'Subscription ended'
default:
return ''
}
}
async function render() {
const user = await bill.getUser()
document.querySelector('#plan').textContent = user.plan?.name ?? 'Free'
document.querySelector('#subscription').textContent = subscriptionLine(user)
const manage = document.querySelector('#manage')
manage.hidden = !user.subscription
manage.textContent = user.subscription?.status === 'past_due' ? 'Fix payment' : 'Manage subscription'
}
document.querySelector('#manage').addEventListener('click', () => bill.openPortal())
bill.onChange(render)
render()
Outbound events
| Event | Sent when |
|---|---|
subscription.created | Created from an approved checkout. |
subscription.activated | Active at signup or on resume. |
subscription.renewed | A renewal is collected (with order.paid for the renewal order). |
subscription.updated | A plan change is confirmed or PayPal updates the subscription. |
subscription.payment_failed | A renewal fails and the subscription becomes past_due. |
subscription.suspended | Paused by you, the customer or PayPal. |
subscription.canceled | Canceled. The payload includes canceledBy and cancelAt. |
subscription.expired | PayPal expired it. |
entitlement.granted / entitlement.revoked | Access starts or ends as a result. |
Payloads contain the subscription record and the customer. Envelope and signatures: Webhooks.