๐Ÿ—๏ธ
๐Ÿ—๏ธ Build a SaaS with Larz ยท LARZ-601 ยท Session 3 of 6

Plans, Trials & Subscriptions

This is where a SaaS makes money - and where Larz shines. A free tier, a paid Pro plan, free trials and recurring billing are decorators and config, not a payments project.

โฑ 9 min read๐Ÿ“… Updated 2026-07-27๐Ÿ“Š Tables, charts & examples

Now the part that turns an app into a business: charging for it. In most frameworks this is a big, error-prone project - payment SDKs, webhooks, entitlement logic, trial handling. In Larz it's the built-in core. We'll add a free tier and a paid Pro plan with a trial, and wire real payments - without writing checkout or webhook code.

๐Ÿ“Œ Worked example
One decorator vs a payments project. In a typical framework, adding a paid Pro tier means integrating a payment SDK, writing checkout pages, building webhook handlers, storing entitlements, and coding trial-and-renewal logic - days of fiddly, error-prone work. In Larz, the same thing is @app.paid('$9/mo', trial_days=7) above the route: unentitled visitors are sent through checkout, the trial and renewal are tracked for you, and switching from the dev mock to live Stripe doesn't change your routes. The business logic that usually sprawls across a project collapses into a line.

A paid tier in one decorator

Gate premium features behind @paid. An unentitled visitor is automatically sent through checkout; a paying one gets in. Trials are a parameter.

@app.login_required
@app.paid('$9/mo', trial_days=7)   # Pro plan, 7-day free trial
@app.get('/pro/reports')
def reports(req):
    return render_reports(req.user)

@app.metered('$0.01/call')         # or bill per API call from credit
@app.post('/api/v1/enrich')
def enrich(req): ...
PrimitiveUse
@paid('$9/mo', trial_days=7)Subscription with a free trial
@paid('$29')One-off purchase
@metered('$0.01/call')Pay-per-use from prepaid credit
@plan('pro')Gate on a named plan/tier

Free vs paid tiers are just which routes carry @paid or @plan. The framework tracks entitlements, trials and renewals for you.

Real payments, provider-agnostic

In dev, a keyless mock provider drives checkout. To go live, pass a real provider - your routes don't change - and point its webhook at Larz.

from larz.providers import StripeProvider
money.enable(app, provider=StripeProvider(
    api_key='sk_live_...', webhook_secret='whsec_...'),
    base_url='https://yourapp.com')
# webhook -> /larz/webhook/<provider>: Larz verifies + grants entitlement, no code
๐ŸŽฏ
Swap providers without touching your app. Stripe, Paddle, PayPal, Paystack, GemVault, crypto - all behind the same interface, so you can switch or add providers without changing a single route. Larz verifies webhook signatures, grants entitlements and records invoices automatically. The money logic (exact amounts, trials, renewals) is the framework's job, not yours.

Wire the business model

  • @paid for subscriptions and one-offs; @metered for usage; @plan for tiers.
  • Trials are a parameter, not a project.
  • Providers are swappable - dev mock to live Stripe/Paddle/etc. with no route changes.
  • Add a ledger + PDF invoices with the larz[money] extra (larzledger, larzpdf).

๐ŸŽฏ Key takeaways

  • Charging is Larz's built-in core - a paid tier is @paid, a trial is a parameter, metering is @metered.
  • Free vs paid tiers are just which routes carry @paid/@plan; the framework tracks entitlements and renewals.
  • Payments are provider-agnostic: dev mock to live Stripe/Paddle/PayPal/etc. with no route changes.
  • Larz verifies webhooks, grants entitlements and records invoices for you; larz[money] adds a ledger + PDF invoices.

Frequently asked

How do free trials and renewals actually work without me coding them?

Larz's money layer tracks entitlements and their state for you. When you write @paid('$9/mo', trial_days=7), the framework handles sending unentitled users through checkout, granting a trial entitlement, and recognising when it converts to a paid subscription or lapses - and it records invoices from verified provider webhooks. You focus on what a paid user can access (the routes behind @paid); the lifecycle (trial, active, renewal, expiry) is managed by the framework and, with the larz[money] extra, modelled explicitly by larzsubscription. You're configuring a business model, not building a billing system.

Is it safe to take real payments with this?

The money logic and entitlement handling are built and tested in the framework, and actual money movement goes through established payment providers (Stripe, Paddle, PayPal, etc.) via their real APIs, with Larz verifying webhook signatures. As with any payment setup you follow the basics - real provider keys from environment variables, HTTPS, and testing in the provider's test mode before going live - but you're not hand-rolling the risky parts. The provider handles card data and compliance; Larz handles the entitlement and invoice logic; you configure and test. The production session covers the go-live checklist.

Session 3 of 6 complete

Next up: Admin Panel & Revenue Dashboard

Continue to Session 4 โ†’

Related lessons

More in this course

Course home → · Browse all courses →