zooqueenandHanzo Dev ca44ba0ab4 fix(billing): a coupon names its plans; quotes are never cached; a mail panic is caught
A plan coupon covers only the plan slugs it names. SetCoupon refuses an
empty list and any slug that is not a paid plan on sale in the plan
authority (listed, priced, not contact-sales), so a typo is refused at the
PUT instead of at checkout, and a row written with no list covers nothing.

GET /v1/billing/plans?coupon= answers Cache-Control and CDN-Cache-Control
no-store: a quote is a code's standing now, and the catalog's hour of edge
caching must never answer it.

The sale notice's goroutine recovers a panic in the mail rail and logs it,
so a sender fault never takes down the binary that embeds commerce.


Co-authored-by: Hanzo Dev <[email protected]>
2026-10-09 12:18:05 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00

commerce

commerce

Checkout, billing, pricing, invoicing — the light commerce router for the Hanzo platform. NOT in PCI-DSS scope (PAN data lives in hanzoai/vault).

Status License

Quick start

docker run -p 8001:8001 ghcr.io/hanzoai/commerce:latest

What this is

commerce handles orders, products, subscriptions, invoices, and customer records for every Hanzo deployment. It is CDE-connected, not CDE-in-scope: card data is tokenized at hanzoai/vault and commerce only ever sees the token. The service is production multi-tenant (37+ X-Org-Id call sites), IAM-integrated, and already exposes func Mount(*zip.App, cloud.Deps) error — it is one of the three reference implementations of the HIP-0106 Mount contract.

Specs

Implements:

  • HIP-0037 AI Cloud Platform (billing surface)
  • HIP-0106 Unified Cloud Binary (commerce subsystem — already exposes Mount())

Architecture

   client  ->  gateway  ->  commerce (zip.App)
                              |
                     orders / products / subscriptions / invoices
                              |
                  +-----------+-----------+
                  |                       |
              hanzoai/vault          billing provider
              (CDE — tokenizes PAN)   (Stripe etc., webhook in)
                              |
                  per-tenant data via base (HIP-0302)

Development

sh scripts/fetch-plans.sh                  # vendor the @hanzo/plans catalog (go:embed)
go run ./cmd/commerce -dev                  # API on 127.0.0.1:8090

Data lives under COMMERCE_DIR (default ./commerce_data), one SQLite file per org. The build needs cgo with the sqlite_math_functions tag, or CGO_ENABLED=0 for the pure-Go SQLite backend.

Test

export GOWORK=off CGO_ENABLED=1 GOFLAGS=-tags=sqlite_math_functions
go vet ./...
go test ./billing/... ./payment/...
go run github.com/onsi/ginkgo/v2/ginkgo -r test/

The same gates run in CI from hanzo.yml.

License

MIT OR Apache-2.0 (LICENSE, LICENSE-MIT, LICENSE-APACHE) per HIP-0137 One License; vendored third-party terms are in NOTICE.

S
Description
Multi-tenant commerce and billing — orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.
Readme
18 MiB
Languages
Go 53.9%
TypeScript 27.7%
HTML 8.8%
MDX 8.3%
JavaScript 0.9%
Other 0.3%