We need some mechanism that is tamper proof
Given that comment - no. If the checkout has valid discounts at the time of its last update then it will persist.
Are you willing to share a little more about why you need that? Why would a custom discount no longer be valid?
The custom discount is no longer valid if there are discount caps. Like we want to offer the discount 100 times. If we offer it 101 times we are financially liable to pay for the extra discount. It would be nice if there was to make a blocking call back into our system to enforce some transactionality.
I actually found that the line item scripts execute one last time after the user clicks the pay now button. Thank god because that is all Shopify gives us that is actually secure. If the total has changed it will direct the user back to an order review page rather than the thank you page. Its not ideal and we have to bend over backwards to make this transactional but I guess it works. We are making the offers available in customer tags as well as tracking in a database on our side so ensure we only put the offer in 100 customer tags. Then we have to manage deleting these tags if the user abandons the checkout for a few hours.