N° 01 Usage-metered starter

Charge credits for every action.

Plans grant credits, actions spend them — meter generations, API calls, exports, render minutes, or any per-use action through one credit ledger in a left-sidebar member app. Auth, billing and a dedicated admin app already done.

PHP + SQLite · no build step · one cheap VPS

Metered & honest

Watch the meter, not the invoice.

Every action carries a price. Every price hits one append-only ledger. The balance you see is the balance you have — debited up front, refunded on failure, never negative.

Per-action pricing Balance-after rows Refund on failure
PAY PER RUN

Every action costs credits. Every credit is accounted for.

Wrap any per-run tool in consume_credits_for_action() and the metering is handled for you. Plans top up the balance each period; the ledger records where it went.

One function, metered actions

Wrap an export, a lookup, a render, an AI call or render minutes in consume_credits_for_action() and it debits the balance atomically. No double-spend, no half-charged runs — the deduction and the work commit together or not at all.

An append-only ledger

Every spend and every top-up is a row: amount, action, balance-after, timestamp. Nothing is mutated in place, so a user's history reconciles to the current balance by addition — handy when someone emails asking where 40 credits went.

Per-action pricing, gated by balance

Set the cost per action in one place — a cheap lookup at 1 credit, a heavy render at 25. Tools live in the member sidebar app and open freely; each run is gated by the balance, not a hard tier wall, and a zero balance routes to top-up. Change the price without touching the call sites.

Period top-ups via Stripe

Plans grant a credit allotment each billing cycle. The Stripe webhook credits the ledger on renewal; cancellations stop the top-up, not the account.

Refund a failed run

If an action throws after it charged, credit the same amount straight back to the ledger. The reversal is its own row, so the audit trail stays honest.

Meter from the browser or the API

The same consume_credits_for_action() path backs both a logged-in user clicking 'Run' and a script hitting your API with a key. One balance, one ledger, whether the spend comes from public/api.php or a jQuery button — so usage-based billing works for humans and machines without a second accounting system.

The ledger, line by line

Read the balance backwards — every credit has a row.

Top-ups, spends, and a refund land as append-only rows with a balance-after, so the number on the account is just the column added up.

ActionTypeAmountBalance after
Scale plan renewal · stripe+2,0002,000
Run premium workflow · web-251,975
Generate report export · web-101,965
AI image generation · api_key-11,964
Refund: export failed mid-run · web+101,974
Create a note · api_key-11,973
The ledger, by the numbers

Every credit accounted for, to the row

Usage metering where the books always balance — debits, top-ups and refunds all land in one append-only ledger.

1 ledger for spends, top-ups, refunds and admin grants alike
0 negative balances possible — a short charge rolls back, never writes
1 row per event, with the balance-after stamped on every single one
4 plan tiers granting 25 to 2,000 credits each billing period — every gated action checks the balance before it runs, with admin grants minted from the admin app
Keep the infrastructure small. Make the product yours.
This store and its demos use the same PHP and SQLite foundation included in your download.
1 SQLite database
web_build_stepnone
source_codeincluded
hostingyour own server
database_modeSQLite WAL
Superadmin, not a spreadsheet

A real admin console — have a poke around.

Every install ships with this. Search users, replay webhooks, inspect billing and revoke keys — server-rendered, access-gated, no second app.

app.yoursaas.com/admin superadmin
MRR£4,820▲ 12%
Active subs138▲ 6
Credits today29,400spent
Signups · 7d52▲ 18%
UserPlanStatusJoined
ada@example.comProactive2d ago
grace@example.comScaleactive5d ago
linus@example.comStarterpast due3w ago
margaret@example.comProactive1mo ago
blocked@example.comFreeblocked1mo ago
processedinvoice.paidevt_1Q8x…a3
processedcustomer.subscription.updatedevt_1Q8w…f1
processedcheckout.session.completedevt_1Q8w…7c
retryinginvoice.payment_failedevt_1Q8v…02
refundedcharge.refundedevt_1Q8u…9d
curl -H "Authorization: Bearer ss_live_••••" \
     https://app.yoursaas.com/api.php?resource=notes

{
  "ok": true,
  "data": [ "note_18f2", "note_18f9" ],
  "rate_limit": "58/60",
  "credits_left": 1840
}
From download to charging cards

Preview locally. Connect services. Launch.

01

Unzip & copy

copy a template folder

02

Install & connect

composer install · Stripe + SES

03

Ask your agent

rebrand · plans · run doctor

04

Deploy & charge

NGINX + PHP-FPM · take cards

Try the local app before configuring billing or email. Provider approval and deployment take additional time.

Pricing you control

Tiers, access levels and credits from one config file.

Define plans in app/subscriptions.php, attach Stripe price IDs, and the checkout flow stays generic across every project.

Included

Free

£0

Default access for new users and trial accounts.

Access 025 starter credits
Subscription

Starter

$19/mo

For a small paid SaaS tier.

Access 10100 credits/mo
Subscription

Pro

$49/mo

For heavier usage and premium features.

Access 20500 credits/mo
Subscription

Scale

$149/mo

For power users and high-credit products.

Access 302,000 credits/mo
Questions

The honest FAQ.

Get started

You’re already inside.

This is a live, fully interactive demo — explore every screen. Nothing you do is saved and no payments are real.

Get Simple Stack Launch offer · £49