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.
Related
Lesson 11: Gas-Metered Functionsgas N and --ledger - what's next after paywalls and subscriptions.→Lesson 9: Money-Native Basicswallet, price, pay - the primitives paywall and subscribe are built out of.→Lesson 8: Error Handling โ try/catchrequire and try/catch - the exact guardrail used to gate access here.→What Is Larzscript?The full explainer on the money-native pitch, including paywalls and subscriptions.→Build a Subscription PaywallThe cookbook recipe this lesson's examples are drawn from.→