Restore deleted payment


A few months ago IIRC I deleted a paid invoice by mistake. I then must have undeleted it since it’s in my invoices list, but its associated payment was most likely also deleted and at the time I didn’t think about trying to fix it. Fast forward to now, I have some accounting to do and I could not find the payment associated with the said invoice; I then had a look in the “trash” and I found it, but I can’t restore it.

Is this normal? I am for now stuck with a paid invoice linked with no active payment.


When you delete an invoice, it can be restored and the associated payment can be restored with it. However when a payment is deleted, this is non-reversible.

I see! I’m not sure what I did back then (so I can’t comment on the behaviour you describe), but I now do have an invoice that had its associated payment deleted somehow, yet the invoice still shows as paid, even though I can’t see the payment details for it. I tried creating a new payment ton link it with the paid invoice, but IN won’t let me since there is no pending invoice to select under the payment settings.

How can I then make sure to have a payment entry in the system that matches the paid status of the invoice?

Hi @david,

I tried a few operations on a test company and I’m not sure Invoice Ninja behaves exactly as you describe regarding deleted paid invoices. For instance, here is an invoice I just created and marked as paid:

I then deleted it and restored it right after. It’s still marked as paid, but the payment is no longer associated to it:

If I go manually to the said payment details, we can see that it is unliked from the invoice there too:

However, if I delete that payment, the invoice status is reverted back to “sent” and I can’t restore the payment - this part is like you said.

The thing is, in this test, deleting a paid invoice and restoring it did break something, as the interface would not show the restored payment and the invoice as linked together, even though they were still somehow linked under the hood. In my real case, the glitch was worse, because the payment was never restored, yet the invoice was still marked as paid, with no payment that I could associate with it, since it was deleted “for good”.

I tried resorting to dirty tricks: I went to the database and changed the payment status from “is_deleted” to “0”, which worked to restore it, and then I went to the activities table, looked for the invoice ID last entry, changed its activity_type_id to 54 and added the payment ID to that line, but that didn’t work to relink the invoice and the payment and I didn’t dig want to dig deeper into the db than that. I reverted my database backup and I ended up simply cloning the problematic invoice to a new invoice, deleting the first and then properly applying a payment to the second one, but I wish there was a better way to fix this.



Any idea why the UI is not linking the invoice <=> payment after a restore?

In the backend I do see an issue where the paymentable is not restored. However even after correcting this, the UI does not show the link between invoice/payment.