PayFanout API reference
    Preparing search index...

    Interface SubscriptionRecord

    interface SubscriptionRecord {
        anchorDay?: number;
        billingDetails?: {
            address?: {
                city?: string;
                country?: string;
                line1?: string;
                postalCode?: string;
            };
            email?: string;
            name?: string;
        };
        cancelAtPeriodEnd: boolean;
        canceledAt?: string;
        createdAt: string;
        currentPeriodEnd: string;
        currentPeriodStart: string;
        failedAttempts: number;
        id: string;
        lastError?: { code: string; message: string };
        lastPaymentId?: string;
        metadata?: Record<string, string>;
        nextRetryAt?: string;
        pendingRenewal?: PendingRenewal;
        plan: Required<SubscriptionPlan>;
        pspCustomerId: string;
        pspName: string;
        savedPaymentMethodToken: string;
        status: SubscriptionStatus;
    }
    Index
    anchorDay?: number

    Day-of-month (1-31) the billing cycle anchors on — recorded at creation and on a lapsed resume when the interval is month/year. Advancement clamps it per target month WITHOUT eroding it: Jan 31 -> Feb 28 -> Mar 31. Records predating this field keep the clamped-forward behavior.

    billingDetails?: {
        address?: {
            city?: string;
            country?: string;
            line1?: string;
            postalCode?: string;
        };
        email?: string;
        name?: string;
    }

    AVS data forwarded on every charge — some PSPs (Paysafe) demand a zip on stored-token charges when the vaulted handle carries no billing data (browser-tokenized cards). Persisted with the record so renewals have it.

    cancelAtPeriodEnd: boolean
    canceledAt?: string
    createdAt: string
    currentPeriodEnd: string
    currentPeriodStart: string

    ISO 8601 — the paid-through window. The next charge is due at currentPeriodEnd.

    failedAttempts: number

    Consecutive failed renewal attempts for the CURRENT period (dunning).

    id: string
    lastError?: { code: string; message: string }
    lastPaymentId?: string

    pspPaymentId of the latest successful charge.

    metadata?: Record<string, string>
    nextRetryAt?: string

    ISO 8601 — when past_due, the earliest instant the next retry may run.

    pendingRenewal?: PendingRenewal

    Money-safety state — stores MUST persist this field; dropping it re-charges unresolved renewals.

    plan: Required<SubscriptionPlan>
    pspCustomerId: string
    pspName: string
    savedPaymentMethodToken: string