Larzscript Course · Lesson 10 of 15

Paywalls & Subscriptions as Keywords

Larz covers Larzscript's subscription primitives: paywall names a price per month and who it pays, subscribe charges a wallet into one, and require ... has ... gates access by subscription.

paywall and subscribe

A paywall is a price per month paid to a wallet. subscribe charges a wallet into it right away:

wallet customer = $20.00
wallet business = $0.00
paywall pro = $9.00 / month to business

subscribe customer to pro

print("customer:", customer.balance)
print("business:", business.balance)
Output
customer: $11.00
business: $9.00

require ... has ... โ€” gated access

Someone who hasn't subscribed gets blocked - require ... has ... throws, the same guardrail from Lesson 8's error handling:

wallet guest = $20.00
wallet business = $0.00
paywall pro = $9.00 / month to business

try {
    require guest has pro, "must be subscribed"
    print("access granted")
} catch e {
    print("blocked:", e["message"])
}

subscribe guest to pro
require guest has pro, "must be subscribed"
print("access granted now")
Output
blocked: must be subscribed (line 6)
access granted now

Every snippet on this page is run through the real larzscript interpreter, not hand-typed โ€” what you see in the Output blocks is the actual output, for everything shown: a real monthly charge and a real gated check.

← Lesson 9Course syllabusGitHub