diff --git a/apps/simplex-badge-service/web/README.md b/apps/simplex-badge-service/web/README.md
index 0004b44944..ae2f5b37e5 100644
--- a/apps/simplex-badge-service/web/README.md
+++ b/apps/simplex-badge-service/web/README.md
@@ -56,10 +56,10 @@ is plain TypeScript, tested directly in Node.
| `format.ts` | Money, countdowns and elapsed time as the words a screen prints |
| `store.ts` | The three `localStorage` keys — session, orders and the chosen theme |
| `order.ts` | What an order's state means: what to keep from a response, which screen it selects, and its history row |
-| `routing.ts` | Reading `?order=` and the store into what to render |
+| `routing.ts` | Reading `?order=`, the step hash with its `?app=` flag, and the store into what to render; the `simplexchat:` link that hands a code to the app |
| `api.ts` | The three routes — create, cancel and read — and the long-poll wait loop, with `fetch`, sleep and the clock injected |
| `flow.ts` | Payment flow control logic — pure, no DOM, no globals |
-| `stripe.ts` | Loading Stripe.js, mounting the Payment Element, confirming, and the no-key stand-in |
+| `stripe.ts` | Loading Stripe.js, mounting the Payment Element, confirming, and refusing the card path with no key |
| `icons.ts` | The badge art, the payment marks and the hamburger, built with `createElementNS`. The brand mark is NOT here: it is a served file |
| `qr.ts` | A QR encoder written for this page, with no dependency, no network and no raster |
| `screens.ts` | Every screen of the spec, and the header and its menu, built node by node — markup is never assigned from a string |
@@ -183,6 +183,29 @@ which is what the page's own wait loop relies on — no polling on a timer.
Card invoices (`"method":"card"`) get a `clientSecret` in the response
instead of an address; BTC and XMR get `address` and `cryptoAmount`.
+### Opening the page as the app does
+
+The SimpleX app opens the page at a step hash carrying a flag, which decides
+only how the code is handed over at the end. Both endings can be driven here:
+
+```
+http://localhost:8099/#/tier?app=true # Return to SimpleX, with Show code under it
+http://localhost:8099/#/tier?app=desktop # the code screen, saying the Redeem code screen is already open
+```
+
+With no flag the page ends as it always has.
+
+**Open each in a fresh private window.** The flag is read once, at load, and
+kept in the session; nothing re-reads it when the hash changes, so editing the
+address bar of a page that is already open does nothing. A session left over
+from an earlier purchase in the same browser has already spent its flag at
+checkout, and the ending falls back to the plain code screen.
+
+Pay with Monero or Bitcoin and settle it with `/control/settle` above — the
+card path needs a Stripe key. A code the browser could not store also falls
+back to the plain screen, so a browser that blocks `localStorage` never shows
+the `app=true` ending at all.
+
### The Stripe key
The publishable key lives in a `` element
@@ -191,12 +214,10 @@ in `public/index.html`, committed empty. `mock/server.py` substitutes
set to anything but a `pk_`-prefixed key (a secret or restricted key would
otherwise be baked into a page anyone can read).
-With no key set, the card path renders a labelled development stand-in
-instead of a Stripe Payment Element: its button does what a successful
-confirm does, and settling it calls the mock's `/control/settle` directly.
-**This stand-in cannot appear when a key is set** — the code path that
-builds it is unreachable once Stripe.js has actually loaded. To see the real
-Payment Element, set a test key:
+With no key set there is no card path at all: `cardPlan` answers
+`unconfigured`, `renderCardForm` returns before it builds anything, and
+choosing Card reaches "The card form did not load". Drive a purchase with
+Monero or Bitcoin instead, or set a test key:
```
STRIPE_PUBLISHABLE_KEY=pk_test_... python3 mock/server.py --port 8099
diff --git a/apps/simplex-badge-service/web/mock/server.py b/apps/simplex-badge-service/web/mock/server.py
index af7612a084..009aea31d4 100644
--- a/apps/simplex-badge-service/web/mock/server.py
+++ b/apps/simplex-badge-service/web/mock/server.py
@@ -9,9 +9,9 @@ Environment:
STRIPE_PUBLISHABLE_KEY substituted into the
served index.html. Public by design, but still not
committed: unset, the page has NO card form and
- renders the development stand-in instead, whose
- button does what a successful confirm does and whose
- settling is POST /control/settle/ below.
+ choosing Card reaches "The card form did not load",
+ so drive a purchase with btc or xmr and settle it
+ with POST /control/settle/ below.
Set it to a `pk_test_...` key to drive the real
Stripe path; a secret key here is refused at start.
"""
@@ -111,8 +111,8 @@ def public_view(inv):
def with_publishable_key(html):
"""The publishable key is compiled into the page. Here it comes
from the environment, so nothing that could be a real key is ever written
- back into public/index.html. Unset leaves the committed empty value, which
- is what selects the development stand-in."""
+ back into public/index.html. Unset leaves the committed empty value, with
+ which the page offers no card form at all."""
if not STRIPE_PUBLISHABLE_KEY:
return html
text, found = KEY_META.subn(lambda m: m.group(1) + STRIPE_PUBLISHABLE_KEY + m.group(2), html.decode())
@@ -314,7 +314,7 @@ def main():
print(f"mock badge service on http://localhost:{port}", flush=True)
print("stripe: " + (f"publishable key {STRIPE_PUBLISHABLE_KEY[:11]}… — the real card form"
if STRIPE_PUBLISHABLE_KEY
- else "no STRIPE_PUBLISHABLE_KEY — the card path renders the development stand-in"),
+ else "no STRIPE_PUBLISHABLE_KEY — no card form; pay with btc or xmr"),
flush=True)
server.serve_forever()
diff --git a/apps/simplex-badge-service/web/public/index.html b/apps/simplex-badge-service/web/public/index.html
index dcf5e7d4b2..6caac72b84 100644
--- a/apps/simplex-badge-service/web/public/index.html
+++ b/apps/simplex-badge-service/web/public/index.html
@@ -20,17 +20,17 @@
Support SimpleX
-
-
+
+
-
+
-
+
-
+