Handling Wallet Refunds and New Invoices

Hello ,

I need some guidance on managing invoices related to our wallet feature. When a user returns funds to their wallet and then uses that balance for a new invoice, what’s the correct way to process this?

Should I:

Record the wallet balance as a prepayment on the new invoice and generate a credit note for reference? I'm concerned that this credit note may not be generated with the required invoice type code 386.

Alternatively, would it be more appropriate to apply the wallet balance as a discount on the new invoice?

I want to ensure that we adhere to ZATCA compliance while effectively handling these transactions. Any advice or insights would be greatly appreciated!

Thank you!