Buy a forge at /pricing (#11138)
Open /pricing with no account. Each plan shows its size, price, crew credit said as a count of ordinary asks ("Crew credit for 10 ordinary asks each month."; the free plan's is "…once, to start"; left out when it is under one ask) and forge count, read from the same plans as GET /api/v1/plans (test/pricing-plans-agree.test.ts). Type the forge's name and an email, press the paid plan's button, pay at the provider's checkout, and the page you return to (/pricing/done) shows the claim link once. Open it to take the forge over.
- Asks, not dollars (#16132): an ask costs the
billing.ask_centslimit (default 50 cents; the operator sets it from the crew's ledger, under Limits), and a credit is shown as whole asks, rounded down.creditWordsinsrc/billing/plan_words.tsbuilds the sentence for /pricing, the home's plans, the terminal's plans screen and the owner's plan row (the host writes the ask price into the forge'splan.json).GET /api/v1/plansand the structured data on /pricing stay in dollars (creditUsd, "Crew credit (USD a month)"). Test:bun test test/pricing-words.test.ts. - Free plan: its button goes to
/forges/new. - Closed the tab?
/pricing/resend: name and email you bought with; a new link is mailed there (needs mail configured) and the old one stops. - No provider connected: paid plans show their price and one muted phrase, "not on sale yet · ask the operator".
- Operator: connect Stripe under Settings → Billing. A paid order whose forge could not be made shows under "Paid, not made" with Retry and a link to the provider's dashboard to refund; a flow alarm names it.
- Limits: one client address may have 3 orders waiting at once (counted by socket address, never a header); a name is held 35 minutes and the provider's checkout stops being payable at 31, so a late payer never finds the name given away; a claim link is mailed again at most once a day per order.
- Terminal: palette → "Get a forge (plans)" (
src/tui/screens/pricing.ts): up/down picks a paid plan, Tab switches name/email, Enter places the order (the per-address cap counts the SSH client's bucket). The checkout address is printed as text to open anywhere; after paying press r, and the claim link appears once, by the ticket the order was placed with. Free is not sold there: use Start my forge. Test:bun test test/tui-pricing.test.ts. - Receipt (#16046): the page after payment links to
/pricing/orders/<id>: the plan, the amount, the day the payment arrived (UTC) and the forge, with a download of the same as printable HTML (/pricing/orders/<id>/receipt.html?download=1). Only the buyer (the order's cookie, two days) or an admin who is a person can open it; anyone else, and an order not yet paid, gets a missing page. The amount is the price stored on the order when it was made (orders from before that show "not recorded"). The page after payment links to it whichever way the link is shown. The terminal prints the same four facts when the order is ready, claimed or not, but has no way to the printable HTML: that file is the buyer's browser's (the cookie), so open the receipt page there. Code:src/billing/receipt.ts. Test:bun test test/billing-order-receipt.test.ts. - Code:
src/actions/order.ts(rules),src/billing/orders.ts(store),src/web/pages/pricing.ts(pages). The paid path is described indocs/SPAWN.md. - Test:
bun test test/pricing-order.test.ts.
After the card form (#13262)
Under the order form /pricing lists three steps, from AFTER_PAYMENT_STEPS in
src/billing/plan_words.ts: you pay, a forge is made, a link arrives by email.
The same words are the "After you pay" row on /terms, the line under the plans
(AFTER_PAYMENT) and the terminal's pricing screen. One block holds the steps, the
lapse sentence /terms also prints, and the Terms and Privacy links. With no
payment provider the page says paid plans are not on sale yet and shows the steps
as what will happen; the terminal screen hides them.
Price follows the place, and at-cost codes (#16205)
When paid forges run on a cloud account (Pinned forges → "paid forges run on"), the buyer may pick where it runs. The plan's price is for the plan's default place. A dearer place adds the difference to the monthly price, rounded up to the next dollar: "Show the price" renders the plans with the chosen place and says on each plan what the place adds, and the checkout line says it too ("Small forge (digitalocean:nyc3:s-2vcpu-4gb: +$12 a month)"). The amount is fixed when the order is placed and kept on the order, and the checkout charges exactly it (inline price_data, no dashboard setup).
An at-cost code is made where a gift code is (Settings → Billing → Codes, POST /api/v1/codes with kind: "at_cost", the terminal's codes screen with c), with uses and an expiry as now; the link it gives is /pricing?code=…. A buyer with one pays the place's monthly cost plus the payment fee (src/billing/at_cost.ts: 2.9% and 30 cents, grossed up so the forge keeps the cost), rounded up to the next dollar: the plan row shows "was" the normal price and "at cost" with the amount. A code is for one plan and never gives a plan free: the gift door refuses it (wrong_kind), and a gift code is refused here. A use is held by each open checkout (name held for 30 minutes) and spent when it is paid, so one use cannot fund many pending orders; a checkout that lapses gives its use back. Revoking stops new checkouts; one already open and paid is honoured at the price it quoted. Every look at a code, by the link or by Show the price, counts a try for the client, as a gift code's does.
At-cost needs a machine to cost, so it is refused while paid forges run hosted.
Settings → Billing, and the terminal's Sold forges screen (admin only), list each sold forge: plan, place, what its machine costs, what the buyer pays, the provider's fee and the margin. An at-cost forge reads zero margin. Orders keep the cost they were sold at, so a catalog that moves later rewrites no past sale.
Not done yet: an at-cost subscription does not follow a place's later cost change at its next renewal. Test: bun test test/order-cloud.test.ts test/at-cost.test.ts.