> ## 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.

# BillPay Wallet

> Jane saves a debit card in BillPay Wallet and later wants to remove it.

## Real-World Example

Jane saves a debit card in BillPay Wallet and later wants to remove it. If that card is attached to an upcoming scheduled payment, the portal should block deletion until Jane moves the schedule to another valid method.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Consumer opens BillPay Wallet"] --> B["Portal loads saved payment methods"]
    B --> C["Consumer adds, edits, or deletes a method"]
    C --> D{"Method used by scheduled payments?"}
    D -->|No| E["Wallet change is saved"]
    D -->|Yes| F["Portal blocks unsafe deletion or asks for replacement"]
    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,C actor;
    class B,E system;
    class D decision;
    class F risk;
    class E outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should let consumers manage saved payment methods safely.
* It should prevent deletion of payment methods assigned to scheduled or failed payments unless replacement rules are satisfied.
* It should support updating scheduled transactions to use a different saved method when allowed.

## How It Should Not Work

* It should not break a payment plan by deleting the only assigned payment method.
* It should not expose payment profiles from another consumer.
* It should not store sensitive card data outside the approved gateway/profile service.

## Developer Notes

* Wallet behavior affects Payment Setup, Schedule Plan, and background installment processing.
* Always check scheduled transaction usage before destructive wallet changes.

## Related App Areas

* `app/Livewire/Consumer/BillPayWallet.php`
* `app/Livewire/Consumer/Forms/BillPayWalletForm.php`
* `app/Livewire/Consumer/Forms/UseSavedPaymentMethodForm.php`
* `app/Services/Consumer/PaymentProfileService.php`
