Payment customisation - Hide COD payment when user applies the discount code

Hello, Please let me give a solution for removing the COD payment method or else customize the payment method which is from extensions of shopify when the user enters the discount code.

This means that wants to remove/hide the COD payment method when the user applies a discount code at checkout with an extension of the payment method customization of Shopify.

Please let me know if anyone has a solution without a third-party app/plugin. Only go with the Payment customization extension.

I made a similar solution for a client when gift card is applied , hide COD. I used the App Called Checkout Rules , build with Payment Customisation extension but the customer should be Shopify Plus

Here is how the Rule look like,