Clavem

How to deliver software downloads after payment

Deliver downloads from a page or link created after the payment is confirmed by webhook, make links expire, and give buyers a way to get a fresh one. The success page is a convenience, not a delivery system, because buyers close tabs and Stripe tells you to use webhooks.

The short answer

Build delivery in three layers. A webhook confirms the payment. A server-side function creates a link that expires. A page, an email and the app each show that link, and each can ask for a fresh one. If the buyer loses the email or the link expires, they come back to the page instead of writing to you.

The mistake to avoid is making the Stripe success page the only place the download appears. Stripe’s fulfilment guide says you must use webhooks to make sure fulfilment happens for every payment, and that the redirect only lets customers see details immediately after paying. A buyer on a flaky connection who closes the tab on the redirect still paid.

Six ways to deliver, compared

Method How it works Strength Weakness
Success page Redirect to your site with ?session_id={CHECKOUT_SESSION_ID}, look up the Checkout Session, show a link Instant, nothing to wait for Lost if the tab closes. The page can be shared. Not a record of delivery
Email with a permanent link Webhook sends a mail with a fixed URL Easy to build, easy to find later Never expires, so one forward gives it away
Email with a signed link Webhook sends a mail with a URL that expires Stale links stop working The buyer needs a way to get a new one
Private order page A secret URL per order lists the current files and creates fresh links on every visit Buyer can return any time. You can show instructions next to the file You build and host it
In-app download The app sends the license key, the server returns a link if the key is valid Gated by the same key as the app. Also delivers updates Only works for buyers who already have the app
Public installer, key gates the app Anyone can download. The app stays in trial or locked mode until a key is entered Simplest. No delivery code The file is not secret, so it is wrong for templates and asset packs

For an app that does nothing useful without a key, the last row is usually enough for new users, with a private order page as the receipt. Sellers of templates, plugins delivered as ZIPs, and fonts or assets need real gating because the file is the product.

A signed link needs no database. The server signs the file id and an expiry time with a secret, and checks both when the link is used. This runs on plain node:crypto:

import crypto from 'node:crypto';

const SECRET = crypto.randomBytes(32); // server-side only, kept stable in real use
const b64url = (buf) => buf.toString('base64url');

export function signDownload(fileId, ttlSeconds = 3600, now = Math.floor(Date.now() / 1000)) {
  const exp = now + ttlSeconds;
  const sig = b64url(crypto.createHmac('sha256', SECRET).update(`${fileId}.${exp}`).digest());
  return `/d/${fileId}?exp=${exp}&sig=${sig}`;
}

export function checkDownload(url, now = Math.floor(Date.now() / 1000)) {
  const u = new URL(url, 'https://example.com');
  const fileId = u.pathname.split('/').pop();
  const exp = Number(u.searchParams.get('exp'));
  const sig = u.searchParams.get('sig') ?? '';
  if (!Number.isInteger(exp) || exp < now) return 'expired';
  const want = crypto.createHmac('sha256', SECRET).update(`${fileId}.${exp}`).digest();
  const got = Buffer.from(sig, 'base64url');
  if (got.length !== want.length || !crypto.timingSafeEqual(got, want)) return 'bad signature';
  return 'ok';
}

I ran it. A fresh link returned ok. The same link checked two hours later returned expired. Changing the file id to another file, or editing exp to a far-future date, returned bad signature, because both are inside the signed string. Two details matter:

  • Sign the file id together with the expiry. If you sign only the expiry, one link works for every file.
  • Compare with timingSafeEqual, not ===.

Use expiring links, not single-use links. Mail scanners and link previews can open a URL before the buyer does, and a single-use link is then spent.

Stripe’s part: confirm first, redirect second

When you set a success_url and also have a webhook endpoint listening for checkout.session.completed, Stripe’s documentation says Checkout waits up to 10 seconds for your server to answer the webhook before it redirects the buyer. That is useful: if your webhook creates the link and answers quickly, the success page can show it straight away. But answer fast, and do the slow work, such as sending the email, after you have replied.

The webhook function and the success page should call the same fulfilment function, keyed by the Checkout Session id, so a buyer who reloads the success page does not get a second order. How to add license keys to Stripe shows that function.

For delayed payment methods, the session completes as unpaid and the money arrives later with checkout.session.async_payment_succeeded. Show the success page, but say the download arrives by email once the payment clears. Do not hand out the file while the payment is still unpaid.

Large files and flaky connections

Installers get large. Three things keep downloads from failing:

  • Support byte ranges. Then an interrupted download resumes where it stopped, and download managers work. A resumed request from the command line looks like curl -L -C - -O "<url>".
  • Serve as an attachment with the filename you want, so the browser saves it instead of trying to render it.
  • Tell buyers what an expired link means. A resume request that arrives after the link has expired fails, so say on the page that they can reopen it for a fresh link.

Where you host the file decides what a popular download costs, because bandwidth is where file delivery gets expensive. Clavem serves files from object storage with no egress fees.

People lose emails. The delivery design must answer “where do I get it again” without you:

  • A private order page that creates new links on every visit.
  • A device or key lookup page, so a buyer with only the key can still get back in. See lost license keys.
  • An update check in the app. A buyer who still has the app can ask the server for the latest build with their key. Check for updates in a desktop app covers it.

Buyers you migrated from another platform often have none of these, because an import creates licenses, not orders.

Doing this with Clavem

Clavem does the order page and the signed links. You upload a release to a product, give each file an optional platform label (macos, windows), and publish it. Each paid Stripe order gets a private order page that lists the files of the latest published release with fresh links. Links are signed and valid for one hour, an expired one answers 403 with a message to open the order page again, and downloads support byte ranges. Files can be up to 5 GiB, uploaded in parts of at most 10 MiB, and downloads are not metered.

The same release is available to your app through a public endpoint. A valid key adds download links to the response. Here is a real call against the demo product, which has no release published:

curl https://clavem.io/v1/releases/1/latest
{"error":{"code":"not_found","message":"This product has no published release yet."}}

For a product with a release, the response holds version, notes, published_at and a files array, and each file has a url only when the license is valid for that product. “Latest” means most recently published, not the highest version number. Licenses imported from another platform have no order page, so their owners get downloads through that endpoint or from your site. See releases and downloads for the limits, and the free plan includes 1 GB of storage. Buyer pages live on Clavem’s domain: custom domains for them are not offered.

Questions

Do I need to protect the installer if the app checks a license key?

Often not. If the app does nothing useful without a valid key, a public installer is fine and simpler. Protect downloads when the file itself is the product: templates, plugin ZIPs, asset packs, or builds for paid upgrades and betas.

How long should a download link last?

Long enough to finish a download, short enough that a forwarded link goes stale. One hour is a common choice and is what Clavem uses. The buyer then gets a fresh link from the order page, so a short life costs them nothing.

Can a Stripe Payment Link deliver a file?

Not by itself. Stripe's fulfilment guide applies to Payment Links as well as Checkout, and it describes webhooks as the way to trigger fulfilment. Something you run, or a service, must create the download link.

Sources

  1. Stripe docs, fulfil orders after Checkout (as of November 2026)
  2. Stripe docs, custom success page (as of November 2026)