API ReferenceREST /api/v1Sign in

Kiwi Host — To do

Status key: [x] done · [~] in progress · [ ] not started

1. Billing (works now, no panel needed)

- [x] Per-invoice overdue schedule: retry day 1 and 3, overdue notice day 7, suspend day 14, final notice day 44, removal day 51 - [x] Paid invoices skip all later steps (no wrongful suspension) - [x] Renewal notices: annual 30 + 7 days before, monthly 7 days before - [x] Card-expiry warning before renewal - [x] Failed payment, card-declined and "approve payment" emails - [x] Abandoned orders cancelled after 7 days, one email - [x] Payments recorded once (locked), partial payments handled - [x] Renewal invoice and period move together (no skipped periods) - [x] Storage subscriptions on the same schedule (suspend = read-only, remove = keys revoked) - [x] Race-free customer and subscription numbers (DB sequences) - [ ] Cancel / turn off auto-renew in portal (decided: not in scope now) - [ ] Stripe test-mode run: stripe trigger for payment_failed and requires_action - [ ] Verify card-expiry notice with a real test card - [ ] Tax: collect billing address and GST number at checkout (NZ tax invoices) - [ ] Annual plan discount (decision pending)

2. Sign-up and checkout

- [x] Order creates account, subscription and invoice only (no server set-up before payment) - [x] Idempotency key claimed first; triple-submit gives one order - [x] Verification email sent; hosting waits for verified email - [x] Old /live page removed; order goes to sign-in, then the invoice - [x] Signed-in customers land on the invoice (next parameter) - [x] Resend verification email button in portal - [ ] Card entry at checkout (Stripe Payment Element in the order form) — currently pay after sign-in - [ ] Browser check: order form → sign-in → pay → verify (end to end) - [ ] Password reset flow check

3. Server tasks (manual Hestia work, until API is ready)

- [x] Billing raises tasks: create, suspend, unsuspend, delete - [x] Admin page /server-tasks with steps, details and "Mark done" - [x] Email to ops for each new task - [x] Mark done moves subscription and hosting account - [ ] Browser check of /server-tasks (create + done) - [ ] Decide: who gets the ops email (OPS_EMAIL in .env)

4. Portal (client)

- [x] Dashboard rebuilt: service cards, usage, billing, activity - [x] Server tab (shown only when HOSTING_PANEL_MODE=api) - [x] Storage tab - [x] Nav hides panel pages in billing-only mode; direct links redirect to dashboard - [x] Dashboard hides server links in billing-only mode; optional control-panel link - [~] Sidebar "Domains" icon still links to a hidden page — gate it like the other items - [ ] Browser check at desktop and phone width - [ ] Remove any remaining template-only items on Website workspace

5. Hosting panel API (Hestia) — needed to switch `HOSTING_PANEL_MODE=api`

- [ ] Real Hestia API client (current code is simulated only) - [ ] Executor registered in worker: create account, suspend, unsuspend, delete - [ ] Sync usage (disk, bandwidth, inodes) into hosting accounts - [ ] Test on a non-production Hestia server first - [ ] Set HOSTING_PANEL_URL to the control panel login

6. Public website (www)

- [x] GoDaddy clone homepage removed; new homepage from honest parts - [x] Template-only copy removed (24/7, money-back, cPanel, AI builder, fake reviews) - [x] Plans: Monthly / Yearly toggle, no cart, GST note - [x] Header and footer trimmed to real links - [x] Status page shows "unavailable" instead of fake 100% - [ ] Browser check of order page, VPS, WordPress, status - [ ] Privacy policy page (footer currently links Terms only)

7. Admin (staff)

- [x] Sample-only pages hidden from menu; routes show "Not available yet" - [x] Dashboard, customers (list + detail), tickets (list + reply), servers on live data - [x] Fake header buttons removed - [ ] Audit log page (currently placeholder) - [ ] Remove unused sample resource routes once confirmed unneeded - [ ] Browser check of each live page

8. Servers and capacity (OVH)

- [ ] Record the OVH server (75 GB) in the database - [ ] Set disk quotas in Hestia; 10 GB packages (decision: 5 clients × 10 GB) - [ ] Backups off the server (send to AWS S3) - [ ] Disk alerts at 70% and 85% - [ ] Retire old 50 / 80 / 100 GB plans in the catalog

9. Databases

- [x] MySQL/MariaDB for clients (through Hestia) - [ ] Decide on MongoDB (not offered; Atlas as add-on if a client asks)

10. Engineering checks before go-live

- [ ] pnpm verify (lint, typecheck, tests, prisma validate) — last full run had only pre-existing memory-panel type errors - [ ] Fix pre-existing adapters-dns and adapters-panel typecheck / build errors - [ ] Run graphify update . (needs pip install 'tree-sitter>=0.23.0') - [ ] Review and commit the migrations (20261106000000_object_storage, 20261107000000_billing_lifecycle, 20261107010000_code_sequences) - [ ] Remove .env secrets from any shared copy; keep test keys out of commits - [ ] Production: real SMTP, real Stripe webhook secret, real AWS keys (STORAGE_AWS_*)

Decisions still open

- Storage prices per GB and overage (placeholders: 50c and 75c) - Currency for AU customers (currently NZD only) - Staff ops email address for server tasks

Markdown source
# Kiwi Host — To do

Status key: [x] done · [~] in progress · [ ] not started

## 1. Billing (works now, no panel needed)
- [x] Per-invoice overdue schedule: retry day 1 and 3, overdue notice day 7, suspend day 14, final notice day 44, removal day 51
- [x] Paid invoices skip all later steps (no wrongful suspension)
- [x] Renewal notices: annual 30 + 7 days before, monthly 7 days before
- [x] Card-expiry warning before renewal
- [x] Failed payment, card-declined and "approve payment" emails
- [x] Abandoned orders cancelled after 7 days, one email
- [x] Payments recorded once (locked), partial payments handled
- [x] Renewal invoice and period move together (no skipped periods)
- [x] Storage subscriptions on the same schedule (suspend = read-only, remove = keys revoked)
- [x] Race-free customer and subscription numbers (DB sequences)
- [ ] Cancel / turn off auto-renew in portal (decided: not in scope now)
- [ ] Stripe test-mode run: `stripe trigger` for payment_failed and requires_action
- [ ] Verify card-expiry notice with a real test card
- [ ] Tax: collect billing address and GST number at checkout (NZ tax invoices)
- [ ] Annual plan discount (decision pending)

## 2. Sign-up and checkout
- [x] Order creates account, subscription and invoice only (no server set-up before payment)
- [x] Idempotency key claimed first; triple-submit gives one order
- [x] Verification email sent; hosting waits for verified email
- [x] Old `/live` page removed; order goes to sign-in, then the invoice
- [x] Signed-in customers land on the invoice (`next` parameter)
- [x] Resend verification email button in portal
- [ ] Card entry at checkout (Stripe Payment Element in the order form) — currently pay after sign-in
- [ ] Browser check: order form → sign-in → pay → verify (end to end)
- [ ] Password reset flow check

## 3. Server tasks (manual Hestia work, until API is ready)
- [x] Billing raises tasks: create, suspend, unsuspend, delete
- [x] Admin page `/server-tasks` with steps, details and "Mark done"
- [x] Email to ops for each new task
- [x] Mark done moves subscription and hosting account
- [ ] Browser check of `/server-tasks` (create + done)
- [ ] Decide: who gets the ops email (`OPS_EMAIL` in .env)

## 4. Portal (client)
- [x] Dashboard rebuilt: service cards, usage, billing, activity
- [x] Server tab (shown only when `HOSTING_PANEL_MODE=api`)
- [x] Storage tab
- [x] Nav hides panel pages in billing-only mode; direct links redirect to dashboard
- [x] Dashboard hides server links in billing-only mode; optional control-panel link
- [~] Sidebar "Domains" icon still links to a hidden page — gate it like the other items
- [ ] Browser check at desktop and phone width
- [ ] Remove any remaining template-only items on Website workspace

## 5. Hosting panel API (Hestia) — needed to switch `HOSTING_PANEL_MODE=api`
- [ ] Real Hestia API client (current code is simulated only)
- [ ] Executor registered in worker: create account, suspend, unsuspend, delete
- [ ] Sync usage (disk, bandwidth, inodes) into hosting accounts
- [ ] Test on a non-production Hestia server first
- [ ] Set `HOSTING_PANEL_URL` to the control panel login

## 6. Public website (www)
- [x] GoDaddy clone homepage removed; new homepage from honest parts
- [x] Template-only copy removed (24/7, money-back, cPanel, AI builder, fake reviews)
- [x] Plans: Monthly / Yearly toggle, no cart, GST note
- [x] Header and footer trimmed to real links
- [x] Status page shows "unavailable" instead of fake 100%
- [ ] Browser check of order page, VPS, WordPress, status
- [ ] Privacy policy page (footer currently links Terms only)

## 7. Admin (staff)
- [x] Sample-only pages hidden from menu; routes show "Not available yet"
- [x] Dashboard, customers (list + detail), tickets (list + reply), servers on live data
- [x] Fake header buttons removed
- [ ] Audit log page (currently placeholder)
- [ ] Remove unused sample resource routes once confirmed unneeded
- [ ] Browser check of each live page

## 8. Servers and capacity (OVH)
- [ ] Record the OVH server (75 GB) in the database
- [ ] Set disk quotas in Hestia; 10 GB packages (decision: 5 clients × 10 GB)
- [ ] Backups off the server (send to AWS S3)
- [ ] Disk alerts at 70% and 85%
- [ ] Retire old 50 / 80 / 100 GB plans in the catalog

## 9. Databases
- [x] MySQL/MariaDB for clients (through Hestia)
- [ ] Decide on MongoDB (not offered; Atlas as add-on if a client asks)

## 10. Engineering checks before go-live
- [ ] `pnpm verify` (lint, typecheck, tests, prisma validate) — last full run had only pre-existing `memory-panel` type errors
- [ ] Fix pre-existing `adapters-dns` and `adapters-panel` typecheck / build errors
- [ ] Run `graphify update .` (needs `pip install 'tree-sitter>=0.23.0'`)
- [ ] Review and commit the migrations (`20261106000000_object_storage`, `20261107000000_billing_lifecycle`, `20261107010000_code_sequences`)
- [ ] Remove `.env` secrets from any shared copy; keep test keys out of commits
- [ ] Production: real SMTP, real Stripe webhook secret, real AWS keys (`STORAGE_AWS_*`)

## Decisions still open
- Storage prices per GB and overage (placeholders: 50c and 75c)
- Currency for AU customers (currently NZD only)
- Staff ops email address for server tasks