Retrait middleware