Due to the large number of air flights these days, all procedures involved in their operational management should be carefully optimized. This work presents a novel approach to the seat assignment problem, which focuses on deciding where to seat the passengers of different online purchases. This problem is currently solved by most airlines with a set of simple pre-defined rules that do not take into account future sales. Instead, the approach in this work is based on solving an integer multicommodity network flow problem, where different commodities are associated with expected future demands of different types of passengers. One feature of the developed optimization model is that it has to be solved online (that is, in real time), thus it must be both effective and fast, which prevented the use of more sophisticated (but also more time consuming, as it was experimentally observed) models based on stochastic programming. Using a real database of flights by Vueling Airlines S.A., we generated a set of synthetic online purchases simulating a pseudo-real flight. Applying our approach to this synthetic data, we observed that (1) the optimization model could be satisfactorily solved in real-time using the state-of-the-art CPLEX solver; (2) and the seat assignment obtained was of higher quality than that obtained by the simple pre-defined rules used by airlines.