Jamie here from Shopify. Typically your best bet is to do a partial refund of your order for the amount the discount should have been for. This Shopify Doc goes into detail about this process. You can refund whatever value is applicable to this order. You can find the refund button on an orders page (admin > order > select the particular order) - see screenshot.
As an alternative, you do have the option to refund and cancel the order and have your customer place it again with the appropriate discount code. We don't have the option to retroactively add a discount code after the fact at this time.
I hope that helps! Cheers,
Jamie | email@example.com