billing

package
v1.799.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package billing embeds the Next.js-built billing admin SPA into the commerce binary. Source lives at github.com/hanzoai/billing and builds into out/ via `pnpm build`. The Dockerfile billing-build stage clones the repo and copies out/ into ui/dist, which is then go:embed'd here. Local Go test runs only need .gitkeep in ui/dist/ so the directive resolves.

Mirrors the admin/embed.go + checkout/embed.go pattern. All three SPAs (commerce admin, pay, billing) ship in a single commerce binary.

Billing admin SPA HTTP handler.

The embedded SPA (ui/dist, populated by the Dockerfile billing-build stage from github.com/hanzoai/billing) is served at /admin/billing/*. Access is gated on IAM roles: admin, billing_admin, owner, or superadmin — and the legacy IsAdmin claim. Non-admin callers (including unauthenticated) get a plain 404 so the route's existence does not leak.

IAM auth is performed here, not by the global /v1/commerce middleware chain: this handler sits under /admin, outside that group. We accept the Bearer token, parse the IAM JWT, and check roles.

Index

Constants

This section is empty.

Variables

View Source
var UIFS embed.FS

UIFS is the embedded billing admin SPA bundle.

Functions

func UIHandler

func UIHandler(prefix string, iam *auth.IAMClient) gin.HandlerFunc

UIHandler returns a gin handler that serves the embedded billing admin SPA at the given mount prefix (typically "/admin/billing"). Unauthorized requests get a plain 404 — no existence leak.

The IAMClient is optional in test harnesses; a nil client (IAM disabled) means every request is treated as unauthorized, which produces the same 404 — safer fail-closed default.

func UISub

func UISub() fs.FS

UISub returns the ui/dist subtree as an fs.FS — ready for http.FS.

Types

This section is empty.

Directories

Path Synopsis
Package allotment grants a plan's recurring monthly included-usage credit to a tenant's prepaid balance.
Package allotment grants a plan's recurring monthly included-usage credit to a tenant's prepaid balance.
Package bucket is the ONE place that classifies commerce ledger transactions into the three money buckets the console + GPU policy read, and derives the per-bucket balances from the REAL tagged ledger — never a fabricated split.
Package bucket is the ONE place that classifies commerce ledger transactions into the three money buckets the console + GPU policy read, and derives the per-bucket balances from the REAL tagged ledger — never a fabricated split.
Package credit provides reusable starter credit logic.
Package credit provides reusable starter credit logic.
Package engine provides core billing business logic: usage aggregation, payment collection, and subscription lifecycle management.
Package engine provides core billing business logic: usage aggregation, payment collection, and subscription lifecycle management.
Package grant implements manual subscription grants — used for gifting Pro subscriptions, comp'ing beta users, and admin overrides.
Package grant implements manual subscription grants — used for gifting Pro subscriptions, comp'ing beta users, and admin overrides.
Package husdindex is Step 3 of the chain-backed credit ledger: it makes the on-chain HUSD balance the source of truth and the commerce DB a cache.
Package husdindex is Step 3 of the chain-backed credit ledger: it makes the on-chain HUSD balance the source of truth and the commerce DB a cache.
Package husdledger wires the chain-backed credit ledger (treasury mint service + husdindex projector, Steps 2-3) to commerce's production per-org SQLite stores, and exposes the ONE mint entrypoint (Service.MintCredit) the billing handlers call in place of a direct DB credit write (Step 4).
Package husdledger wires the chain-backed credit ledger (treasury mint service + husdindex projector, Steps 2-3) to commerce's production per-org SQLite stores, and exposes the ONE mint entrypoint (Service.MintCredit) the billing handlers call in place of a direct DB credit write (Step 4).
Package ledger implements a double-entry accounting ledger for the billing engine.
Package ledger implements a double-entry accounting ledger for the billing engine.
Package tier defines the tiered credit system for Hanzo billing.
Package tier defines the tiered credit system for Hanzo billing.
Package trial implements the new-signup on-ramp: a trialing subscription of the $20/mo entry plan funded with a single unified trial credit.
Package trial implements the new-signup on-ramp: a trialing subscription of the $20/mo entry plan funded with a single unified trial credit.
Package workflows provides Temporal workflow definitions for automated recurring billing, subscription lifecycle management, and dunning retry logic.
Package workflows provides Temporal workflow definitions for automated recurring billing, subscription lifecycle management, and dunning retry logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL