Skip to content

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

L2 Checks passed 3 of 3 runsv1.0.0Tech-Realm/space-billing-and-subscriptions-public

Install

logicpacks pack use billing-and-subscriptions-public/run-subscription-lifecycle-and-dunning
get_pack billing-and-subscriptions-public/run-subscription-lifecycle-and-dunning

The 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

  1. States: trialing -> active | past_due; active -> past_due (payment_failed) -> active (payment_succeeded) | canceled (dunning_exhausted).
  2. Dunning: retry on days 0, 3, 5, 7 after the first failure, email each time, cancel after the last.
  3. 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).