Skip to content

Legal pages, discount codes and account credit - #48

Merged
ashutosh091 merged 5 commits into
previewfrom
feat/legal-discounts-credits
Nov 14, 2026
Merged

ashutosh091 merged 5 commits into
previewfrom
feat/legal-discounts-credits

Conversation

@ashutosh091

Copy link
Copy Markdown
Contributor

Adds the three pages Stripe needs before live payments (FW-605), discount codes, and account credit.

Legal pages

  • /terms, /privacy and /refunds, in the pricing page's header and footer, prerendered so GitHub Pages answers 200. Linked from the footer bar and the sign-up page, and in the sitemap.
  • Content is in site/src/constants/legal.ts and names ERP.AI MA LLC, Massachusetts law and support@floodwall.ai. Needs a legal read before go-live, and the mailbox must exist.

Discount codes

  • GET /billing/promo?code=… checks a code with Paygate and returns what it takes off ("20% off for 3 months").
  • POST /billing/checkout takes an optional code and applies it up front; without one, Stripe Checkout still shows its own code box.
  • The account page and the pricing page (signed in, on Free) have a code field. /pricing?code=LAUNCH20 keeps the code for the tab through sign-up.
  • Codes are made in Paygate: Apps → floodwall → Discounts.

Credit

  • POST /admin/credit (admins): give an account credit in whole dollars, up to $10,000. A request id makes a retry grant once. The Paygate customer is created with the account's email first.
  • GET /billing/credits: the account's balance, shown on /account. Stripe spends it on the next invoices.
  • /app/admin has a Give credit form.

Paygate (already done, not in this diff)

  • Live mode: ERP.AI MA LLC Stripe account, four live prices, webhook to api.floodwall.ai/billing/webhook, return pages on floodwall.ai. The live keys are in Box; the Worker keeps the test keys until sandbox testing is done.
  • The sandbox Team checkout with the 4242 card worked end to end (all webhooks 200, D1 on Team).

Testing

  • npm --prefix api run check: 76 pass (5 new).
  • npm --prefix site run check: typecheck, 24 tests and the build pass; docs/ is rebuilt.
  • Clicked through against a mock service: the legal pages on a phone and in dark mode, applying a code from a link, a wrong code, checkout carrying the code, and the admin credit form.
  • After merge: deploy the Worker (cd api && npm run deploy, no migration needed), then try a sandbox coupon and a credit grant against Paygate test mode.

GET /billing/promo checks a code with Paygate; POST /billing/checkout takes an
optional code and applies it up front. GET /billing/credits returns the
account's Stripe balance, and POST /admin/credit lets an admin grant credit in
whole dollars, keyed by a request id so a retry grants once.
/terms, /privacy and /refunds sit in the pricing page's frame and are linked
from the footer and sign-up. The account and pricing pages take a discount
code (also from ?code=) and show any credit; /app/admin can give credit.
…ts-credits

# Conflicts:
#	api/src/index.ts
#	docs/404.html
#	docs/index.html
#	docs/pricing/index.html
#	site/src/components/shared/SiteHeader.tsx
#	site/src/pages/console/AdminPage.tsx
@ashutosh091
ashutosh091 merged commit 87f20e2 into preview Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant