What it is
kbve.com’s money: credit balances, coupons and the ledger under
/api/v1/wallet, the store and its orders under /api/v1/store and
/api/v1/inventory, the player market under /api/v1/market, and referral
links under /referral and /api/v1/referral. Stripe top-ups and
print-on-demand fulfilment arrive as webhooks on
/api/v1/wallet/topup/webhook and /api/v1/store/pod/webhook.
Where the money is guarded
Not here. Every debit or credit, and the domain write that goes with it, is one
SECURITY DEFINER function in the supabase database: advisory locks, row locks
and a globally unique idempotency key on wallet.ledger. This service checks
who is asking, calls that one function, and maps its error. It must always point
at the same database as anything else that moves credits.
Where it came from
Moved out of axum-kbve with the same paths, status codes and JSON. Three things changed on purpose: Stripe signatures older than five minutes are refused, the Stripe and print-on-demand clients time out before the request does, and store and market writes clear the cached balance instead of leaving it up to five seconds stale.
axum-kbve keeps its own wallet routes until every in-cluster caller (the
Windmill Discord flows call /api/v1/wallet/service/* and
/api/v1/store/service/* on kbve-service directly) is repointed. Both share
the database and the cache keys, so running side by side is safe.
Releasing
Bump version: above. The kbve-wallet job publishes the image and
kbve-wallet-deploy opens the merge request that repoints
kbve-wallet-deployment.yaml.
Discuss on the forum
Questions, fixes and notes on this page live in the KBVE forum.