@pwngh/economy-lab
    Preparing search index...

    Interface Subscription

    The stored state of one recurring subscription. The renewal sweep re-charges it every periodMs from nextDueAt until it cancels or lapses.

    interface Subscription {
        attempts: number;
        id: string;
        nextDueAt: number;
        period: number;
        periodMs: number;
        price: Amount;
        sellerId: string;
        sku: string;
        state: "ACTIVE" | "LAPSED" | "CANCELED";
        txnId: string;
        updatedAt: number;
        userId: string;
    }
    Index
    attempts: number

    Consecutive retryable billing failures: bumped on a retryable failure, reset to 0 on a successful renewal; at config.maxSubscriptionAttempts the sweep lapses the subscription. Adapters must round-trip this field through every save/load path.

    id: string
    nextDueAt: number
    period: number

    Which billing period number it's on (increments each renewal).

    periodMs: number
    price: Amount

    What each renewal charges.

    sellerId: string
    sku: string
    state: "ACTIVE" | "LAPSED" | "CANCELED"
    txnId: string

    The first-charge posting this subscription opened with, whose hashed metadata seals the subscription id, user, seller, and price — the renewal sweep re-proves the row against it before every charge, and a row that fails that proof faults instead of charging. Required, because a nullable anchor would be an anchor the attacker can remove.

    updatedAt: number
    userId: string