Advanced Subscription lifecycle

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

StatusWhat it meansAccess
approval_pendingCheckout started, not yet approved in PayPal.None
activeBilling normally, including during a free trial.Granted. With a scheduled cancellation, until cancelAt.
past_dueA renewal failed; PayPal keeps retrying.Kept for the grace period (graceDays, default 7), then ends
suspendedPaused 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.
canceledFuture billing stopped.Until cancelAt (end of the paid period), or at once with Cancel immediately. After a dunning cancellation, until the grace period ends.
expiredThe plan completed.None

Transitions

FromEventTo
approval_pendingBuyer approves, BILLING.SUBSCRIPTION.ACTIVATEDactive
activeBILLING.SUBSCRIPTION.PAYMENT.FAILEDpast_due
past_dueNext PAYMENT.SALE.COMPLETEDactive
past_dueFailure threshold reached, BILLING.SUBSCRIPTION.SUSPENDED or CANCELLEDsuspended / canceled (canceledBy: dunning)
active / past_dueYou or the customer suspendsuspended
suspendedYou or the customer resume, BILLING.SUBSCRIPTION.RE-ACTIVATEDactive
active / past_due / suspendedCancel (customer, merchant or PayPal)canceled
activeBILLING.SUBSCRIPTION.EXPIREDexpired

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 is active with full access; subscription.trialEndsAt is the first charge date. This is separate from the install trial in UserState.trial (Free trials).
  • Setup fee (setupFee): charged on approval. Plans use setup_fee_failure_action: CANCEL, so if it can’t be collected, PayPal cancels the subscription and no access is granted.
  • Discount codes: a once discount reduces only the first period (a paid trial cycle at the discounted price). A forever discount 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:

  1. Creates a renewal order linked to the subscription, with the PayPal sale ID as capture ID, plus the PayPal fee and net amount.
  2. Emails a receipt (Settings → Emails → Receipts).
  3. Advances currentPeriodEnd to PayPal’s billing_info.next_billing_time.
  4. Resets the failed-payment counter and moves past_due back to active.
  5. Sends subscription.renewed and order.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:

SettingValuesDefaultEffect
failureThreshold1, 2 or 33The plan’s payment_failure_threshold: failed payments PayPal tolerates before suspending.
graceDaysdays7How 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.

  1. PayPal sends BILLING.SUBSCRIPTION.PAYMENT.FAILED. The subscription becomes past_due, pastDueSince is set and you receive subscription.payment_failed.

  2. 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.

  3. PayPal retries on its own schedule. A later success returns the subscription to active.

  4. 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:

  1. Cancels it at PayPal, so no future payments are taken.
  2. Sets cancelAt to currentPeriodEnd: access lasts until the end of the paid period.
  3. Emails the customer (Settings → Emails → Cancellations).
  4. Sends subscription.canceled with canceledBy: customer, merchant, paypal or dunning.

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.suspended on pause and subscription.activated on 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
SituationstatuscurrentPeriodEndcancelAtpaid
In free trialactivefirst charge datenulltrue
Renewing normallyactivenext renewalnulltrue
Canceled, period not overcanceledend of periodend of periodtrue
Payment failed, in gracepast_duedue datenulltrue
Grace period overpast_due / suspended / canceledas last knownas setfalse
Pausedsuspendedas last knownnullfalse
Endedcanceled / expiredas last knownpast datefalse

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

EventSent when
subscription.createdCreated from an approved checkout.
subscription.activatedActive at signup or on resume.
subscription.renewedA renewal is collected (with order.paid for the renewal order).
subscription.updatedA plan change is confirmed or PayPal updates the subscription.
subscription.payment_failedA renewal fails and the subscription becomes past_due.
subscription.suspendedPaused by you, the customer or PayPal.
subscription.canceledCanceled. The payload includes canceledBy and cancelAt.
subscription.expiredPayPal expired it.
entitlement.granted / entitlement.revokedAccess starts or ends as a result.

Payloads contain the subscription record and the customer. Envelope and signatures: Webhooks.