For someone implementing eg an lnurl server or some other server that generates invoices on demand, storing each invoice generated for receiving payments is potentially a large dos issue. Thus, storage should be optional, though storing them is generally useful to see payment status.