Manchester United have agreed to sell Memphis Depay to Lyon for a fee which could increase to £21.7 million.