Skip to content

[audit][P1][edge-case] billing: admin Stripe sync writes null period → sub dropped from weekly-reset sweep #3727

@PierreBrisorgueil

Description

@PierreBrisorgueil

Finding NODE-BILLING-02
File modules/billing/services/billing.admin.service.js:97

syncOrgFromStripe reads stripeSub.current_period_start without the items.data[0].current_period_start fallback used in billing.webhook.service.js:373. Under Stripe API ≥ 2025-08-27 (2026-04-22.dahlia) the top-level field is absent → currentPeriodStart written as null → findAllDueForResetByLastReset (filters currentPeriodStart: { $ne: null }) silently excludes the sub from the weekly reset until a webhook corrects it.

Fix const rawPeriodStart = stripeSub.items?.data?.[0]?.current_period_start ?? stripeSub.current_period_start;

Devkit Node clean audit 2026-05-29 (rev d42eb12). Verified real by an independent refute-by-default reviewer. Fix flows through /feature #N → /verify-qa → /pull-request-finalize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions