# Paid API Starter Runnable local developer application: API-key authentication, SQLite credit ledger, metered text-statistics endpoint, durable idempotent responses, migration and local test UI. Python 3.10+ standard library; no paid account required for the demonstration. `python manage.py init-demo private-demo` creates fresh private state with ten TEST credits. `python server.py private-demo` prints the loopback UI URL. Read the API key from private-demo/api-key.txt into the password field. No real money moves. Do not commit the state directory or serve it as static content. POST /v1/analyze with Authorization: Bearer , Idempotency-Key and JSON {text}. Text max16000 characters. Each new successful result costs one credit; replay with identical input returns the same result, changed input returns409, exhausted balance 402, billing hold423. GET /balance returns credits. No input text is stored, only its hash and statistics. This is local deterministic computation: result/charge commit atomically in one BEGIN IMMEDIATE transaction. A failure rolls both back. Do not replace this operation with a remote paid call without adding durable reserved/uncertain/settled states; transaction rollback cannot undo remote spending. SQLite schema user_version=1, WAL/full synchronous, five-second busy timeout. At most100000 replay records/account; capacity refuses rather than deleting replay protection. Sixteen concurrent HTTP handlers, 64KiB request limit, ten-second socket timeout. State is not encrypted; protect its directory with OS access controls and backups. Reverse proxy/TLS/rate-limits and public deployment are operator work. Payment adapter: POST /stripe/webhook implements signed one-time payment_intent.succeeded snapshot events. Raw-body HMAC-SHA256 v1 signatures, five-minute timestamp tolerance, exact liveMode, object/status/amount/currency and server catalog checks. Demonstration catalog credits-100 =500 US cents,100 credits. Create customer/account mapping server-side; set PaymentIntent metadata account and product=credits-100 server-side, never from an untrusted checkout client. Grants key on PaymentIntent ID, not delivery event ID. Rebinding conflicts fail. This edition does not create Checkout sessions or handle subscriptions/refunds/disputes; use `python manage.py hold private-demo --account demo` for reconciliation holds and clear-hold only after resolution. Configure a real endpoint secret and liveMode only when independently deploying/testing your payment integration. Fixture signatures are tested; actual Stripe delivery or real payment acceptance is not claimed. References checked2026-10-30: https://docs.stripe.com/events/manage-webhook-endpoints and https://docs.stripe.com/api/payment_intents/object. Keep snapshot API/event version compatibility pinned in your Stripe configuration. No credentials included. Run `python -m unittest discover -s tests -v`. Browser visual acceptance pending.