Quickstart (5 minutes)
Create an app, connect PayPal sandbox, add the SDK to your extension and complete a test purchase in about five minutes.
This is the one path from nothing to a working sandbox purchase in a Manifest V3 extension. You need a Chromium-based browser, Node.js with npm, a bundler (Vite, webpack, esbuild or any extension framework) and a PayPal login for the PayPal developer dashboard. No server.
1. Create your app
-
Sign in. Open app.extensionbill.com and sign in with Google. The onboarding wizard opens for your first app.
-
Load your extension unpacked. Open
chrome://extensions, turn on Developer mode, click Load unpacked and pick your extension folder. Copy the 32-character ID shown on its card. -
Describe your extension. In the wizard, enter a name and paste that ID, or import a published listing from its Chrome Web Store URL.
An unpacked ID differs from your store ID. If you restrict allowed IDs, list both (Settings → General).
2. Connect PayPal sandbox
-
Create a sandbox REST app. Open PayPal sandbox apps (Apps & Credentials, toggle on Sandbox), click Create App, choose Merchant and create it. Need help? PayPal guide: get your client ID and secret.
-
Copy the credentials. Copy the Client ID, then click Show under Secret key 1 and copy the Secret.
-
Paste them into the wizard. Wait for Credentials valid and Webhook registered. ExtensionBill registers the PayPal webhook for you.
Screenshots, Live credentials and troubleshooting: Connect PayPal.
3. Create a product
Pick a template in the wizard (Pro lifetime, Pro monthly + yearly or Monthly with 7-day free trial), adjust the amounts and save. ExtensionBill syncs it to PayPal sandbox.
Note the product’s entitlement key, for example pro. That is the string your code checks. Every pricing option: Products & pricing.
4. Install the SDK
npm install @extensionbill/sdk
No bundler? Use the prebuilt file: Without a bundler.
5. Update manifest.json
Add the storage permission (required) and alarms (optional, enables background refresh). No host_permissions are needed.
{
"manifest_version": 3,
"name": "My Extension",
"version": "1.0.0",
"permissions": ["storage", "alarms"],
"background": {
"service_worker": "background.js",
"type": "module"
},
"action": {
"default_popup": "popup.html"
}
}
Point service_worker and default_popup at the files your bundler outputs. Firefox needs two extra keys: Firefox and Edge.
6. Create src/bill.ts
Create the client once and import it everywhere. Your sandbox publishable key (pk_test_…) is in the wizard and in Developers → Integrate.
// src/bill.ts
import { ExtensionBill } from '@extensionbill/sdk'
export const bill = ExtensionBill({
publishableKey: 'pk_test_…', // your sandbox publishable key
})
Publishable keys are safe to ship in your extension. Never put an sk_ server key in extension code.
7. Start the SDK in the background
// src/background.ts
import { bill } from './bill'
bill.startBackground()
startBackground() registers the install, refreshes access, watches checkout tabs and answers your popup, options page and content scripts. Call it once, synchronously, at the top level of the service worker: not inside a listener or after an await, or Chrome will not deliver onInstalled and onStartup to it.
8. Gate a feature
<!-- popup.html -->
<!doctype html>
<html>
<body>
<div id="pro" hidden>Pro feature unlocked.</div>
<button id="upgrade" hidden>Upgrade to Pro</button>
<script type="module" src="popup.js"></script>
</body>
</html>
// src/popup.ts
import type { UserState } from '@extensionbill/sdk'
import { bill } from './bill'
const pro = document.getElementById('pro')!
const upgrade = document.getElementById('upgrade')!
function render(user: UserState) {
const isPro = bill.hasAccess(user, 'pro') // your entitlement key
pro.hidden = !isPro
upgrade.hidden = isPro
}
upgrade.addEventListener('click', () => bill.openCheckout())
render(await bill.getUser())
bill.onChange(render) // fires in every extension context, e.g. after checkout
bill.openCheckout() opens the hosted plan picker with all your active prices. bill.hasAccess(user, 'pro') is true while the user is paid or trialing with the pro entitlement.
Using React, Vue, Svelte or another framework? Swap this file for your stack’s binding: Pick your stack.
9. Load the extension
-
Build and reload. Build your extension, then click the reload icon on its card in
chrome://extensions. -
Wait for “SDK connected”. The wizard’s Add to your extension step switches from Waiting for first install… to SDK connected when your service worker registers its first install. Your install also appears under Customers → Installs.
Still waiting? Open Inspect views: service worker on the extension card and check the console, or create the client with debug: true. 403 extension_not_allowed means the loaded ID is not in your allowed IDs.
10. Make a test purchase
-
Get a sandbox buyer. On PayPal sandbox accounts, open the default Personal account’s … menu → View/Edit account to see its email and password.
-
Pay. Open your popup, click Upgrade to Pro, enter any email on the checkout page, click the PayPal button and log in with the sandbox buyer. Approve the payment.
-
Check the unlock. Reopen the popup: the Pro feature is unlocked. The order is listed under Customers → Orders.
Never use a real PayPal account or card in sandbox. Test cards and failure cases: Testing with PayPal sandbox.
Next steps
- Build your UI with your framework: Pick your stack.
- Use the ready-made plan picker: Paywall UI.
- Gate content scripts and the options page: Checking access.
- Ship real payments: Going live checklist.