Packs / billing-and-subscriptions-public
run-subscription-lifecycle-and-dunning
Run subscriptions through trial, active, past-due and canceled with a dunning retry schedule, refusing invalid transitions
Install
logicpacks pack use billing-and-subscriptions-public/run-subscription-lifecycle-and-dunningget_pack billing-and-subscriptions-public/run-subscription-lifecycle-and-dunningThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
stdlib - Checks: 2 in
outcome/checks.yaml - Code:
billing.py - Tools: python3
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Run subscriptions through trial, active, past-due and canceled with a dunning retry schedule, refusing invalid transitions
Goal
Every subscription is always in exactly one valid state, failed payments are retried on a schedule, and access follows the state.
Steps
- States: trialing -> active | past_due; active -> past_due (payment_failed) -> active (payment_succeeded) | canceled (dunning_exhausted).
- Dunning: retry on days 0, 3, 5, 7 after the first failure, email each time, cancel after the last.
- Gate features on state (active/trialing = on, past_due = grace, canceled = off).
Edge cases
- Payment succeeds after cancel: treat as a new subscription or refund.
- Timezones: schedule retries in UTC.
Don'ts
- Don't delete canceled subscriptions (keep for invoices/audit).