> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Membership Billing

> ABC Collections has an active membership that renews automatically.

## Real-World Example

ABC Collections has an active membership that renews automatically. The scheduled billing job charges the saved profile, records success or failure, and retry jobs pick up failed renewals later.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Membership renewal becomes due"] --> B["Auto-renew command runs"]
    B --> C["Payment job charges saved profile"]
    C --> D{"Payment succeeds?"}
    D -->|Yes| E["Membership stays active"]
    D -->|No| F["Failed renewal is recorded for retry"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A,B,C,E,F system;
    class D decision;
    class E outcome;
    class F risk;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should charge due membership renewals through queued payment jobs.
* It should retry failed auto-renew transactions according to scheduled retry rules.
* It should keep creditor membership state and billing history aligned.

## How It Should Not Work

* It should not charge inactive or cancelled memberships.
* It should not retry failed payments without recording attempts.
* It should not leave creditor access inconsistent with membership state.

## Developer Notes

* Membership billing is platform background processing even though creditors see membership status in their portal.
* Failed and cancelled membership pages are the operator-facing review area.

## Related App Areas

* `app/Console/Commands/MembershipPlanAutoRenewCommand.php`
* `app/Console/Commands/ReprocessMembershipAutoRenewFailedCommand.php`
* `app/Jobs/MembershipPlanAutoRenewPaymentJob.php`
* `app/Livewire/SuperAdmin/Memberships/CancelledMemberships/ListPage.php`
