mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
31 lines
1.4 KiB
Go
31 lines
1.4 KiB
Go
// Package credit holds the canonical starter/welcome-credit policy VALUES.
|
|
//
|
|
// It is data-only: the constants below are the policy a caller passes to the ONE
|
|
// credit primitive, POST /v1/billing/credit (api/billing.Credit). "Granting a
|
|
// starter credit" is therefore just that endpoint called with tag=StarterCreditTag,
|
|
// amountCents=StarterCreditCents, expiresAt=now+StarterCreditDays — there is no
|
|
// second granting code path here (that was the point of the consolidation).
|
|
package credit
|
|
|
|
// Starter credit constants.
|
|
//
|
|
// The welcome/starter credit is a TRIAL (non-cash) grant: $5.00, classified by
|
|
// its `starter-credit` tag into the Credit bucket (billing/bucket.DepositKind),
|
|
// spendable on non-premium metered usage only (never GPUs, never premium models —
|
|
// see hanzoai/ai openai_api.go, which gates premium behind a balance ABOVE the
|
|
// $5 starter). $5 is the ONE canonical amount, shared across the stack: billing
|
|
// app config `trialCreditCents: 500`, ai `StarterCreditDollars = 5.00`, and the
|
|
// cloud-api-models `features.starter_credit: 5.0`. Keep them equal.
|
|
const (
|
|
StarterCreditCents = 500 // $5.00 USD
|
|
StarterCreditTag = "starter-credit"
|
|
)
|
|
|
|
// LifetimeDays is how long a credit is good for. It governs every credit,
|
|
// whichever endpoint it arrives through.
|
|
const LifetimeDays = 365
|
|
|
|
// StarterCreditDays is the starter grant's expiry: the same lifetime, named for
|
|
// its caller so the two cannot drift.
|
|
const StarterCreditDays = LifetimeDays
|