feat(billing): Stripe tier provisioning script (Pay-per-Use / Pro / Scale)#74
Merged
Conversation
…cale)
Adds scripts/stripe_setup_tiers.py — the single source of truth for the
four MolTrust billing tiers in Stripe. Dry-run by default so a re-run
shows exactly what would change without touching Stripe state.
Tier catalogue:
- Free — no Stripe entity, enforced in the API layer (max 5 agents,
30-day validity, score capped at 60)
- Pay-per-Use — 1 product, 4 metered CHF prices:
renewal CHF 0.20, issuance CHF 0.30,
on-chain anchor CHF 0.50, compliance export CHF 19
- Professional — CHF 99/mo recurring, unlimited renewals + anchoring,
quarterly compliance export, 99% SLA, validity ≤ 90d
- Scale — CHF 299/mo recurring, monthly export, anomaly alerts,
7-year retention, validity ≤ 365d
Idempotency: every Stripe Price gets a `lookup_key` (mt_*) and the script
looks the key up before creating — re-runs are safe and don't duplicate
Stripe resources.
Usage:
set -a && source ~/.moltrust_secrets && set +a
python3 scripts/stripe_setup_tiers.py # dry-run
python3 scripts/stripe_setup_tiers.py --live # apply
Verified dry-run works against the production STRIPE_SECRET_KEY without
touching any Stripe state.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/stripe_setup_tiers.py— single source of truth for the four MolTrust billing tiers in Stripe.lookup_key; the script looks up before creating). Nothing in Stripe changes until--liveis passed.Tier catalogue
Usage
Verified
py_compile) — cleanSTRIPE_SECRET_KEYon the server — emits the full JSON catalogue withaction: would-createfor every resource, does not call any mutating Stripe endpoint--liverun is intentionally deferred — Lars to execute and verify the resulting Price IDs in the Stripe Dashboard, then paste them into~/.moltrust_secrets/ DB configOut of scope (intentional)
app/billing.pyrate-limit + validity-cap), no Stripe entity to create.Dry-run sample output
{ "mode": "dry-run", "tier_free": "no_stripe_entity_enforced_in_api", "tiers": { "pay_per_use": { "product": { "action": "would-create" }, "prices": [ ...4 prices... ] }, "professional": { "product": { "action": "would-create" }, "prices": [ ...1 price... ] }, "scale": { "product": { "action": "would-create" }, "prices": [ ...1 price... ] } } }🤖 Generated with Claude Code