Your Electron app has a “Buy” button, and you sell with Paddle, so taxes and invoices are Paddle’s problem. What should the button open? With Stripe you would paste a Payment Link. Paddle has no such link: its checkout is opened by Paddle.js, on a web page of a domain Paddle approved.
This guide builds the whole flow with Paddle Billing: a buy page on your website that opens the Paddle overlay checkout, a “Buy” button in the app that opens that page in the browser, a deep link to come back, and a license key that unlocks the app.
How Paddle Checkout works
Paddle offers three ways to show its checkout:
- Overlay checkout: Paddle.js opens the checkout on top of your page, with
Paddle.Checkout.open(). The usual choice. - Inline checkout: the same checkout, in a frame inside your page’s layout.
- Hosted checkout: a page on
pay.paddle.io, meant for mobile apps that link out to pay. It needs Paddle’s approval on live accounts.
The first two run on your website, and Paddle only allows live checkouts on approved domains: Paddle reviews your website before you can sell. Your app can’t run the checkout from a local file, but it can open a page of acme.com that does.
So the plan is: a small acme.com/buy page that opens the overlay as soon as it loads, and the app opening that page in the customer’s browser.
Create the buy page
Paddle.js needs a client-side token (created in Developer tools → Authentication, starting with live_ or test_) and the id of the price to sell. The page reads the email the app passes in the URL, and prefills it:
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
<script>
// Paddle.Environment.set("sandbox"); // with a test_ token
Paddle.Initialize({ token: "live_7d279f61a3499fed520f7cd8c08" });
const email = new URLSearchParams(location.search).get("email");
Paddle.Checkout.open({
items: [{ priceId: "pri_01hv8xpersonal", quantity: 1 }],
...(email ? { customer: { email } } : {}),
settings: { successUrl: "https://acme.com/thanks" },
});
</script>
<noscript>Enable JavaScript to buy Acme Photo.</noscript>
customer.email fills the first step of the checkout, so a customer who already typed their email in your app doesn’t type it again. successUrl is where Paddle sends them after paying. It has to be a full https:// URL: a custom scheme like acmephoto:// isn’t accepted, which is why the thank you page links back to the app instead.
Selling several plans? Pass the price in the URL too (/buy?plan=team), and map it to a price id on the page. Don’t let the URL carry a raw price id: anyone could put in another one.
Test it in the sandbox
A Paddle sandbox account has its own dashboard, prices and tokens, and takes test cards. Sandbox checkouts work on any domain, localhost included. Call Paddle.Environment.set("sandbox") before Paddle.Initialize, with a test_ token and a sandbox price id, and remove it when you go live.
Open the buy page in the browser
You could load the buy page in a BrowserWindow. Don’t:
- Saved payment details live in the browser. Autofill, the password manager, Apple Pay, Google Pay and PayPal sessions are there; your
BrowserWindowstarts empty. - Trust. A window without an address bar asking for a card number looks like phishing. In the browser, the customer sees
acme.comand the Paddle checkout they know from other apps. - Bank authentication (3D Secure) and PayPal open popups and banking apps, which a real browser handles better.
Open it with shell.openExternal, from the main process:
import { ipcMain, shell } from "electron";
const BUY_PAGE = "https://acme.com/buy";
ipcMain.handle("buy", (_event, email?: string) => {
const url = new URL(BUY_PAGE);
if (email) url.searchParams.set("email", email);
return shell.openExternal(url.toString());
});
The renderer calls buy through your preload script. The URL is built in the main process, from a constant: never pass shell.openExternal a URL that comes from a web page or a message, which could open any program on the computer.
Register a custom protocol
To bring the customer back after paying, give your app a scheme like acmephoto://. Links with it open the app, wherever they’re clicked:
import { app } from "electron";
import path from "node:path";
if (process.defaultApp && process.argv.length >= 2) {
// Development: register the electron binary with the path to your app
app.setAsDefaultProtocolClient("acmephoto", process.execPath, [
path.resolve(process.argv[1]),
]);
} else {
app.setAsDefaultProtocolClient("acmephoto");
}
The packaged app has to declare it too. On macOS, the system only reads it from Info.plist. With electron-builder:
protocols:
- name: Acme Photo
schemes: [acmephoto]
With Electron Forge, set packagerConfig.protocols to the same, and add mimeType: ["x-scheme-handler/acmephoto"] to the Linux makers.
Receive the deep link
macOS and the other systems deliver the link differently:
- macOS sends an
open-urlevent to the running app, or launches it first. - Windows and Linux start a second instance of the app with the URL in its arguments. A single instance lock forwards it to the first one.
import { app } from "electron";
function handleDeepLink(url: string) {
const { host } = new URL(url);
if (host === "purchased") onPurchased();
}
// macOS
app.on("open-url", (event, url) => {
event.preventDefault();
handleDeepLink(url);
});
// Windows and Linux
if (!app.requestSingleInstanceLock()) {
app.quit();
} else {
app.on("second-instance", (_event, argv) => {
const url = argv.find((arg) => arg.startsWith("acmephoto://"));
if (url) handleDeepLink(url);
focusMainWindow();
});
}
// Windows and Linux, when the link launched the app
const launchUrl = process.argv.find((arg) => arg.startsWith("acmephoto://"));
if (launchUrl) app.whenReady().then(() => handleDeepLink(launchUrl));
Register open-url before ready: when a link launches the app on macOS, the event arrives right after startup.
A deep link is untrusted input. Any web page can link to acmephoto://purchased. It can bring the app forward and open the right screen, never unlock anything.
The thank you page
The successUrl page thanks the customer, says where the key is, and links back to the app:
<h1>Thanks for buying Acme Photo!</h1>
<p>Your receipt comes from Paddle, and your license key from us, in a minute.</p>
<a href="acmephoto://purchased">Open Acme Photo</a>
<p>Don't see the app? Open it, and paste the key from your email.</p>
Customers get two emails: Paddle’s receipt, since Paddle is the seller, and the one with their key. Say so on the page, or the receipt gets mistaken for the key.
The browser asks before opening the app. That’s expected, and why the page also says what to do without the link.
Unlock the app with a license key
The overlay emits a checkout.completed event in the page, and the thank you page loads. Neither proves anything to your app: both happen in a browser anyone can script. The proof has to come from Paddle’s servers:
- Paddle sends
transaction.completedto your notification destination, signed with its secret. - Your server creates a license key for the customer’s email, and emails it.
- The deep link brings the app forward, on the activation window.
- The customer pastes the key, and the app validates it with your license server.
With LicenseManager, steps 1 and 2 need no server of yours: connect your Paddle account, map the Paddle price to a policy, and each completed transaction creates a license and emails its key. The deep link handler only opens the activation window:
function onPurchased() {
if (license.getState() !== "ACTIVE") openActivationWindow();
}
The Electron SDK checks the key, ties it to the computer, stores it in the keychain, and keeps the app unlocked offline.
Handle the cases around it
- The customer closes the overlay. Nothing changed. Leave the buy page with a button that opens the checkout again.
- The customer buys from your website. Same buy page, same email, same key: the activation window works whichever way they paid.
- They pay with another email than the one in the app. The key goes to the email of the Paddle checkout. Say it on the thank you page.
- Paddle holds a payment for review, or the method is slow. The key arrives when the transaction completes, not when the overlay closes.
- A subscription. The license has to follow renewals, failed payments and cancellations: see Paddle subscriptions.
- A refund. Paddle reviews refunds. When one is approved, the license should stop working.
- A lost key. Customers find it again in a self-service license portal, without writing to you.
Wrapping up
Paddle Checkout lives on a page of your approved domain, so put a small buy page on your website, open it in the browser from the main process with the customer’s email, and let Paddle redirect to a thank you page that deep links back. Unlock the app with a license key created from Paddle’s transaction.completed event, never from the link or a browser event.
The rest of the app side, from the activation window to offline checks, is in how to add license keys to an Electron app. Using Stripe instead? See Stripe Checkout in an Electron app. For Tauri, read Paddle Checkout in a Tauri app.



