feat(checkout): choose automatic renewal or a one-time yearly Swish payment #301

Sammanfogat
supernaut sammanfogade 1 incheckning från feat/296-renewal-choice in i main 2026-10-06 09:37:45 +00:00
Ägare

Customers choose between automatic renewal by card and a one-time yearly Swish payment, at the same price.

  • Account page: a Yearly / Monthly choice, one withdrawal-period consent checkbox, then "Pay with Swish: one payment, no renewal" (renewal=none) and "Pay with card: renews automatically" (renewal=auto). Without JS, CSS :has() hides the Swish button for Monthly, and the server refuses monthly Swish.
  • Return page /checkout/return (and /en/) works without a session, because a Swish app switch often returns in another browser. The checkout builds an AES-256-GCM token (key derived from SESSION_SECRET with HKDF under its own label) holding the username and when it was made. The page rejects a forged or 7-day-old token, calls subscriptionStatus server-side, and shows only the outcome plus the paid-until date when paid. A charge older than the token is ignored. Then a separate sign-in prompt. Headers: no-referrer, private, no-store, noindex; no analytics script on that page; not in the sitemap.
  • One-time customers see "Paid until " and "Renew". Auto-renew customers see "Renews on ".
  • already_subscribed, payment_pending and one_time_needs_annual each get their own message.
  • Terms (sv and en): one sentence that the one-time yearly option does not renew.

Not included: a "Switch to automatic renewal" button. The billing service refuses an auto checkout while a one-time year runs, so the page shows a hint near the end of the year instead.

Tests: 579 passed; build passes. Version 1.21.0.

Closes #296.

Customers choose between automatic renewal by card and a one-time yearly Swish payment, at the same price. - Account page: a Yearly / Monthly choice, one withdrawal-period consent checkbox, then "Pay with Swish: one payment, no renewal" (`renewal=none`) and "Pay with card: renews automatically" (`renewal=auto`). Without JS, CSS `:has()` hides the Swish button for Monthly, and the server refuses monthly Swish. - Return page `/checkout/return` (and `/en/`) works without a session, because a Swish app switch often returns in another browser. The checkout builds an AES-256-GCM token (key derived from `SESSION_SECRET` with HKDF under its own label) holding the username and when it was made. The page rejects a forged or 7-day-old token, calls `subscriptionStatus` server-side, and shows only the outcome plus the paid-until date when paid. A charge older than the token is ignored. Then a separate sign-in prompt. Headers: `no-referrer`, `private, no-store`, `noindex`; no analytics script on that page; not in the sitemap. - One-time customers see "Paid until <date>" and "Renew". Auto-renew customers see "Renews on <date>". - `already_subscribed`, `payment_pending` and `one_time_needs_annual` each get their own message. - Terms (sv and en): one sentence that the one-time yearly option does not renew. Not included: a "Switch to automatic renewal" button. The billing service refuses an auto checkout while a one-time year runs, so the page shows a hint near the end of the year instead. Tests: 579 passed; build passes. Version 1.21.0. Closes #296.
supernaut lade till 1 incheckning 2026-10-06 09:35:00 +00:00
feat(checkout): choose automatic renewal or a one-time yearly Swish payment
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m45s
58dfd52c4e
Closes #296.
supernaut sammanfogade incheckning 242926ed63 till main 2026-10-06 09:37:45 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web!301
Ingen beskrivning angiven.