Back to blog

How to add payments to a Chrome extension

Step-by-step: add PayPal checkout, paid-status checks, and subscriptions to a Chrome extension in a few lines of code. No backend required.

ExtensionBill Team 5 min read Updated

This is the complete, code-first path to charging money inside a Chrome extension: install an SDK, check whether the user has paid, open a checkout when they haven’t, and get paid straight into your own PayPal Business account. No backend, no webhook plumbing, no license server.

If you’re still choosing a monetization model (one-time license vs subscription vs freemium), read How to Monetize a Chrome Extension in 2026 first, then come back here for the implementation.

What you’ll build

By the end of this guide your extension will:

  1. Know whether the current user has paid (bill.hasAccess(user)).
  2. Open a hosted PayPal checkout page when they haven’t.
  3. Unlock features the moment a payment completes.
  4. Send every payment directly to your own PayPal account, with refunds and disputes manageable from one dashboard.

Total integration is a few dozen lines. Everything runs from your extension’s existing code; there is no server to deploy.

Prerequisites

  • A Chrome extension on Manifest V3 (a background service worker, not a persistent background page).
  • Node and npm if you bundle your extension; a plain <script> include works too.
  • An ExtensionBill account (free tier) with an extension registered, which gives you the publishable key (pk_test_… for sandbox, pk_live_… for live) used below.
  • A PayPal account to create sandbox credentials with, and a PayPal Business account when you go live.

Step 1: Install the SDK

npm install @extensionbill/sdk

If you don’t use a bundler, include the standalone build (extensionbill.global.js, which exposes a global ExtensionBill) in your extension package instead. Either way, the SDK ships with no runtime dependencies and contains no remote code, so it is safe under Manifest V3.

Your manifest only needs the storage permission. alarms is optional but lets the SDK refresh paid status in the background. No host_permissions are required:

{
  "manifest_version": 3,
  "background": { "service_worker": "background.js", "type": "module" },
  "permissions": ["storage", "alarms"]
}

Step 2: Initialize in your background service worker

Create one shared module so every part of your extension uses the same instance:

// bill.js
import { ExtensionBill } from '@extensionbill/sdk'

export const bill = ExtensionBill({ publishableKey: 'pk_test_…' })

Then start it in the service worker:

// background.js
import { bill } from './bill.js'

bill.startBackground()

startBackground() registers the install, sets your uninstall URL, and adds the onInstalled, onStartup, message, and alarm listeners the SDK needs. Call it once, at the top level of the service worker, so the listeners are registered again every time the worker wakes up.

Step 3: Check paid status before unlocking features

Anywhere in your extension (popup, options page, content script), fetch the user and branch on access:

// popup.js
import { bill } from './bill.js'

const user = await bill.getUser()

if (bill.hasAccess(user)) {
  unlockProFeatures()
} else {
  showUpgradePrompt()
}

hasAccess(user) is true when the user has an active purchase or subscription or is inside a free trial. Pass a feature key as the second argument (bill.hasAccess(user, 'pro')) to check a specific plan. The status comes from ExtensionBill’s API and is cached with a signed entitlement token, so it keeps working offline for a while and can’t be unlocked by editing chrome.storage.

Step 4: Open checkout

When a free user clicks your upgrade button, send them to the hosted checkout:

upgradeBtn.addEventListener('click', () => bill.openCheckout())

With no argument, checkout opens a plan picker listing your active prices. Pass a price ID copied from Sell → Products (bill.openCheckout(priceId)) to skip straight to one plan.

Checkout runs on a hosted page with PayPal Smart Buttons: the buyer can pay with their PayPal wallet, Pay Later where eligible, or a debit or credit card. Card data is entered into PayPal’s fields and never touches your extension, which also keeps you out of PCI scope. The money lands in your PayPal account, not in an intermediary’s.

Step 5: React to successful payment

Unlock immediately after purchase instead of waiting for the next status check:

const unsubscribe = bill.onPaid((user) => {
  unlockProFeatures()
})

onPaid fires in every extension context when the user transitions to paid, so the paid experience starts without the user reloading anything. It returns an unsubscribe function for views that close, like a popup.

Step 6: Connect PayPal

This step is configuration, not code. Start in sandbox, then repeat it for live when you’re ready to sell:

  1. Go to developer.paypal.com, log in, and open Apps & Credentials.
  2. Toggle Sandbox at the top, click Create App, choose the Merchant app type, name it, and click Create App.
  3. Copy the Client ID and Secret and paste them into your ExtensionBill dashboard under the PayPal connection step.
  4. ExtensionBill verifies the credentials and registers the PayPal webhook for you. There’s nothing to configure on the webhook side.
  5. When you go live, toggle Live in Apps & Credentials, create a Merchant app on your PayPal Business account, and paste the live credentials the same way. Swap pk_test_… for pk_live_… in bill.js.

The full walkthrough, including the go-live checklist, is in Connect PayPal.

A note on taxes. PayPal processes the payments, but you are the seller, so VAT, GST, and sales tax obligations stay with you. If you need to charge tax, ExtensionBill can add an optional flat tax percentage line to checkout and to receipts. See Taxes for what that does and doesn’t cover.

Step 7: Test the full flow

  1. Load your unpacked extension and confirm getUser() resolves with paid: false for a fresh profile.
  2. Click your upgrade button and complete a sandbox checkout. Log in with a sandbox Personal (buyer) account from developer.paypal.com/dashboard/accounts; no real money moves.
  3. Confirm the onPaid callback fires and features unlock without a reload.
  4. Reload the extension and confirm paid: true persists.
  5. Refund the test order from the ExtensionBill dashboard and confirm access is revoked. Refunds and chargebacks are handled from the dashboard with PayPal; see Refunds & disputes.

Troubleshooting

  • Using the SDK in a content script. That works: import the same bill module. In content scripts, popups, and options pages, the SDK forwards calls to the background service worker via runtime messaging, so make sure bill.startBackground() is running there.
  • Checkout opens but paid status doesn’t update. Make sure bill.startBackground() runs at the top level of the service worker; if it’s inside an event callback it won’t re-register when the worker restarts. See why your extension service worker keeps dying for the full lifecycle rules.
  • Manifest V2 extension. Migrate first; Chrome is done with MV2. See the Manifest V3 migration guide.

Where this fits in the bigger picture

Adding the payment integration is the mechanical part. Picking the model (one-time vs subscription vs freemium), pricing it, and launching it well are covered in the companion guide: How to Monetize a Chrome Extension in 2026. Most paid extensions convert better with a trial in front of the paywall: how to add a free trial to your Chrome extension. For the five-minute version of this guide with your real keys, see the ExtensionBill quickstart.