Okay, last two ideas - there is a backend function where you can update a product. Could you call this to update the product price in the add to cart function?
The only thing with that if it works, is you will want to grab the current price of the product so that you can revert it after the user checks out. I don’t love this solution bc it’s updating the product so if another user were to concurrently try to download the product, it would have a new price if it happened before the revert.
Update Product fields backend
Cart Add Products
The other idea, is you could create and destroy products on the fly as needed
Example: On the add to cart, create a product based on the other one with a price of zero
On checkout, destroy the product.
Remove Product from collection
Create Product
Not the exact same use case as yours, but here is a forum post where a user had to create some custom prices on add to cart which could also help you with ideas