Your First Paid App
Routes, requests, and the @app.paid decorator โ build a working paywall and watch the checkout flow happen automatically.
A Larz route is just a decorated function. Path parameters are typed, and the request object gives you everything about the call.
@app.get("/user/<id:int>")
def show(req):
return {"id": req.params["id"], "q": req.query, "who": req.subject}
Gate a route behind payment
Put @app.paid above any route. An unpaid visitor is redirected to checkout;
when they return, they're entitled and served.
@app.paid("$19") # one-off unlock
@app.get("/report")
def report(req):
return "<h1>Paid report for " + req.subject + "</h1>"
Larz keys entitlements to req.subject โ an anonymous session by default, or a
logged-in user / API key once you add accounts.
What Larz gives you for free
- A checkout flow (mock in dev, real provider in prod) โ you write none of it.
- Built-in pages:
/larz/pricing,/larz/credits,/larz/account, and a/larz/adminrevenue dashboard. - No
if user.is_paidanywhere.
Try it: run the route, click it while "unpaid", complete the mock checkout, and see the paid content. That's the core loop of every Larz app.