Phase 14, part 2: the owner's Billing page

Settings → Billing shows the team's plan, trial, people, agents, storage
and next invoice. The owner subscribes through Stripe Checkout (monthly, or
yearly when there's a price) and pays or reads invoices in Stripe's
Customer Portal; admins see the plan only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:19:30 -07:00
co-authored by Claude Opus 5.5
parent a47990f9bf
commit 8fb79220e3
8 changed files with 498 additions and 2 deletions
+34
View File
@@ -0,0 +1,34 @@
{{define "content"}}{{template "settings-start" .}}{{with .Data}}
<h2>Billing</h2>
{{with .Problem}}<p class="error" role="alert">{{.}}</p>{{end}}
<section class="card">
<h3>{{.Plan.Name}}{{if eq .Account.Status "trialing"}} <span class="pill">trial</span>{{else if eq .Account.Status "past_due"}} <span class="pill warn">payment due</span>{{end}}{{if .ReadOnly}} <span class="pill warn">read-only</span>{{end}}</h3>
<dl class="facts">
{{if eq .Account.Status "trialing"}}<dt>Trial</dt><dd>until {{.Account.TrialEnds.Local.Format "2 Jan 2006"}}; then the Free plan, unless you subscribe</dd>{{end}}
{{if eq .Account.Status "past_due"}}<dt>Payment</dt><dd class="error-text">due since {{.Account.PastDueSince.Local.Format "2 Jan 2006"}}: after 14 days the team becomes read-only, after 60 it's deleted</dd>{{end}}
<dt>People</dt><dd>{{.People}}{{if .Plan.Seats}} of {{.Plan.Seats}}{{else if .Account.Seats}} · {{.Account.Seats}} paid for{{end}}</dd>
<dt>Agents</dt><dd>{{.Agents}} of {{.Plan.Agents}}</dd>
<dt>Storage</dt><dd>{{bytes .Storage}} of {{bytes .StorageOf}}</dd>
<dt>Crawl</dt><dd>{{.Plan.CrawlPages}} pages, {{.Plan.CrawlEvery}}</dd>
{{if .Owner}}{{with .Invoice}}<dt>Next invoice</dt><dd>{{money .AmountDue}} {{.Currency}}, {{.Date.Local.Format "2 Jan 2006"}}</dd>{{end}}{{with .InvoiceErr}}<dt>Next invoice</dt><dd class="muted small">{{.}}</dd>{{end}}{{end}}
</dl>
</section>
{{if .Owner}}
{{if ne .Account.Status "active"}}
<form class="card" method="post" action="/settings/billing/checkout">
<h3>Subscribe to {{.Paid.Name}}</h3>
<p>{{money (int64 .Paid.PerSeatCents)}} a person a month, for every module, {{.Paid.Agents}} agents, {{.Paid.StorageGBPerSeat}} GB per person, and a daily SEO crawl of up to {{.Paid.CrawlPages}} pages. Today that's {{.People}} {{if eq .People 1}}person{{else}}people{{end}}.</p>
{{if .Yearly}}<label class="check"><input type="radio" name="interval" value="month" checked> Monthly</label>
<label class="check"><input type="radio" name="interval" value="year"> Yearly</label>{{end}}
<button type="submit">Subscribe with Stripe</button>
</form>
{{end}}
<form class="card" method="post" action="/settings/billing/portal">
<h3>Payment and invoices</h3>
<p class="help">The card, the billing address, past invoices, and cancelling: on Stripe's page.</p>
<button type="submit" class="secondary" {{if not .Account.Customer}}disabled{{end}}>Open Stripe's billing page</button>
</form>
{{else}}
<section class="card"><p class="help">The team's owner manages the subscription and its payments.</p></section>
{{end}}
{{end}}{{template "settings-end"}}{{end}}