Customer portal
The hosted self-service page where buyers view purchases and receipts, manage subscriptions and license keys, and how to open it from your extension.
Every app gets a hosted customer portal where buyers view receipts, cancel or change their subscription and manage license keys, so you don’t answer those requests by email. Open it from a “Manage subscription” button in your extension.
// options.js
import { bill } from './bill'
const manage = document.getElementById('manage-billing')
manage.addEventListener('click', () => bill.openPortal())
function render(user) {
manage.hidden = !user.customer // only installs linked to a buyer
}
render(await bill.getUser())
bill.onChange(render) // portal changes reach every context
The shared bill client is set up in the Quick start. In a framework, call bill.openPortal() from a button and read user.customer from the binding: see Frameworks.
bill.openPortal() opens the portal in a new tab at https://app.extensionbill.com/portal/<publishableKey>. It uses your app name, icon and brand color, and shows a sandbox banner when opened with a pk_test_ key. Changes made in the portal (cancel, plan change, removing a device) reach the extension on its next refresh, and bill.onChange fires in every open context.
What buyers can do
- See their access: which products are active on their account and until when.
- View purchases and receipts: every paid order, including subscription renewals, with a printable receipt.
- Manage subscriptions: see the next billing date, cancel, change plan, and pause or resume if you allow it.
- Manage license keys: reveal the full key, see which devices use it, and remove a device to free a seat.
- Go back to your extension: a link back to your app’s site or store listing.
Signing in
The portal has no passwords. When it is opened with bill.openPortal() from an install already linked to a customer (it made a purchase or was restored), the buyer is signed in automatically. The URL carries a short-lived sign-in token in the fragment (#t=…), which browsers never send to servers in requests or Referer headers.
Everyone else signs in with the email they used at checkout:
-
They enter their email. ExtensionBill sends a one-time code to that address (up to 5 codes per 15 minutes).
-
They enter the code. Codes are valid for 10 minutes and allow 5 attempts. Errors are
otp_invalid,otp_too_many_attemptsandotp_expired. -
They’re signed in for 2 hours. After that they request a new code.
Canceling a subscription
When a buyer cancels in the portal, ExtensionBill cancels the subscription in PayPal so no further payments are taken. Access continues until the end of the period they already paid for:
user.subscription.cancelAtis set to the end of the current period, anduser.paidstaystrueuntil then.- The buyer receives a cancellation email and you receive the
subscription.canceledevent. - On
cancelAt, access ends andbill.onChangefires.
A canceled PayPal subscription can’t be restarted. To come back, the buyer starts a new checkout from your extension; the portal explains this. See Subscription lifecycle and how PayPal subscriptions work.
Changing plans
With Allow plan change on, buyers can switch between your recurring prices, for example monthly to yearly or Basic to Pro. ExtensionBill asks PayPal to revise the subscription to the new plan:
- If PayPal needs the buyer to approve the new amount, the portal sends them to PayPal to confirm, then back to the portal.
- Until PayPal confirms the change, the portal shows it as pending and the buyer keeps their current plan.
- Once confirmed, access switches to the new product, the buyer gets an email, and you receive
subscription.updated.
Switching between a one-time purchase and a subscription isn’t a plan change; it needs a new checkout.
Pausing
With Allow pause on, buyers can pause a subscription. PayPal stops billing, and the subscription’s access is turned off while paused. Resuming reactivates billing in PayPal and restores access. Pausing is useful for seasonal tools; leave it off if you’d rather buyers cancel and resubscribe.
Receipts
Every paid order, including each subscription renewal, has a receipt at https://app.extensionbill.com/portal/<publishableKey>/receipts/<orderId>. Buyers must be signed in to the portal to open it.
The page is styled for printing and saving as PDF. It shows your seller name and support email, the buyer, the item, discount, tax, total, and the PayPal transaction ID. The same receipt is emailed when the payment completes; you can resend it from the order page in the dashboard. Set your support email and legal details under Settings → General so they appear on receipts. See Emails sent to buyers.
License keys in the portal
For products with license keys, the portal lists each key with its last four characters, status, expiry, and the devices using it (with the label passed to bill.activateLicense). Buyers can:
- Reveal the full key to copy it to a new device.
- Remove device to free a seat when they replace a computer or reinstall.
Customize
Portal settings
Go to Settings → Checkout to choose what buyers may change themselves. These map to App.portal:
| Setting | Field | Default | Effect when on |
|---|---|---|---|
| Allow cancel | allowCancel | On | Buyers can cancel their subscription. |
| Allow plan change | allowPlanChange | On | Buyers can switch to another recurring price. |
| Allow pause | allowPause | Off | Buyers can pause and resume their subscription. |
When a setting is off, the action is hidden in the portal and buyers contact you instead. You can always perform these actions from Customers → Subscriptions in the dashboard.
Show billing status next to the button
function describe(user) {
if (!user.paid) return 'You are on the free plan.'
const sub = user.subscription
if (sub?.cancelAt) {
return `${user.plan.name} is canceled and ends on ${new Date(sub.cancelAt).toLocaleDateString()}.`
}
if (sub?.currentPeriodEnd) {
return `${user.plan.name} renews on ${new Date(sub.currentPeriodEnd).toLocaleDateString()}.`
}
return `${user.plan.name} is active.`
}
Pick up portal changes immediately
Call bill.refresh() when your options page regains focus:
window.addEventListener('focus', () => bill.refresh())
Link from your website or emails
Use the plain URL https://app.extensionbill.com/portal/pk_live_…. Buyers then sign in with their email.