Buy page in the license Worker; Paddle sandbox environment !380

merged merged by cmc on 2026-11-14 03:31 UTC · krz/orgstar:paddle-sandbox into main

Discussion

cmc

Stacked on !379 (merge that first).

  • worker.js serves …/buy and …/license under any route. The buy page shows formattedTotals.total from Paddle.PricePreview (country from request.cf, omitted when unknown) and opens a one-page overlay checkout; checkout.completed goes to the key page.
  • PADDLE_ENV (no default), PRICE_ID, PADDLE_CLIENT_TOKEN are read from the environment and checked; a wrong-environment token or placeholder price throws.
  • wrangler.toml: live routes on krz.sh/apps/orgstar/{buy,license}; --env sandbox deploys orgstar-license-sandbox on krz.sh/apps/orgstar/sandbox/* with sandbox price pri_01m7c13kgj4jcb8xek3ej93j8c.
  • .dev.vars.example lists the secrets; .dev.vars is ignored. buy.html removed.

Tested locally with wrangler dev --env sandbox: price shown, overlay opened, test card payment completed (txn_01m7c1cb6wqatwtf804csthp9k), redirect to the key page. Key issuance needs a sandbox API key, not yet set.