Sell digital products from a single Cloudflare Worker

The Cloudflare Shop Kit handles checkout, delivery and license keys for e-books, templates, software and time passes. Open source under the MIT license, with building blocks for German and EU legal notices.

Download the kit (ZIP, version 0.1.0)

What it does

Quickstart

  1. Unzip, then run npm ci --ignore-scripts and npm test. All provider APIs are mocked; D1 and R2 run in Miniflare.
  2. Describe your product in catalog.yaml and run npm run catalog.
  3. Create a Cloudflare API token with Workers Scripts, D1 and R2 edit rights, plus a Polar access token (checkouts:write, products:read) or a Stripe restricted key (Checkout Sessions write).
  4. Run node scripts/deploy.mjs. It creates D1 and R2, applies migrations, deploys, sets secrets and prints the webhook URL.
  5. Add the webhook in Polar (order.paid, order.refunded) or Stripe, store its secret, deploy again and link to /buy/<sku>.

The full guide, the architecture and the endpoint list are in README.md inside the ZIP. The German pages cover the Schnellstart, the Architektur and the Rechtsbausteine in more detail.

With a merchant of record, the provider sells to the customer, charges VAT and handles withdrawal and refunds; the order page links the provider's buyer terms. For direct sales, the Stripe checkout asks for explicit consent to early performance (§ 356(5) BGB), the consent is stored and confirmed by e-mail (§ 312f BGB). This is not legal advice; have your own texts reviewed.

Verify a license key

The license checker (German) verifies a key in your browser with the shop's public key – the same way your software can do it offline.