Money & Payments · zero-dependency · MIT

larzsubscription

Subscription billing as a state machine.

Models the full billing lifecycle — trial, active, renewal, dunning, proration and cancellation — as an explicit state machine, so recurring revenue logic is correct instead of ad-hoc.

larzscript pkg install subscription
View on GitHub →Learn the stack

What you get

Try it

import "subscription" as subscription
let sub = subscription.start_trial("sub_1", 1209600)
subscription.activate(sub)
print(sub["state"])
subscription.fail_payment(sub)
print(sub["state"])
subscription.recover(sub)
print(sub["state"])
print(subscription.prorate(3000, 30, 10))
Output
active
dunning
active
1000

Why it's in the Larz Stack

larzsubscription is a real Larzscript package (larzscript pkg install subscription) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.