Wallet¶
Purpose¶
Track each user's credit balance with an append-only ledger.
How it works¶
One wallet per user. Balance = sum of append-only WalletTransaction amounts. Available balance subtracts pending reservations. Manual adjustments require a reason and create ledger rows.
Live prototype¶
Requires a logged-in platform session (same browser). Platform user: csorenson@mkpworks.com / Summer2026!.
Live wallet balance
Calls GET /api/v1/wallet/ with the session cookie via mkp.js.
Code to paste¶
<script src="https://YOUR_PLATFORM/sdk/v1/mkp.js"></script>
<script>
MKP.init({ baseUrl: "https://YOUR_PLATFORM", siteKey: "pk_..." });
MKP.wallet.getBalance().then(function (w) {
document.querySelector("[data-balance]").textContent = w.available;
});
</script>
<span data-balance>—</span>
Or declarative: